Vivek Harry
Vivek Harry

Reputation: 439

Declare temp table inside UserDefined Function in DB2 AS400

How to create user defined function with declare temporary table in AS400?

I can't create a temporary table under parent procedure, because i'm using Parallel Jobs. So i need to create temporary table inside function only helps me.

Did anybody knows the solution, kindly update here friends.

Upvotes: 0

Views: 1046

Answers (1)

Esperento57
Esperento57

Reputation: 17472

example of temporary table :

      DECLARE GLOBAL TEMPORARY TABLE nametemporarychoice AS ( 
      YOURQUERYHERE
      ) WITH DATA WITH REPLACE NOT LOGGED;

you can use your table like this:

     select * from qtemp.nametemporarychoice 

or like this:

     select * from session.nametemporarychoice 

Upvotes: 1

Related Questions