opthomas wrote:
A package gives me a logical grouping of functions and procedures. It's a
tidy way of grouping objects.
Let's ignore that and say we go with a structure of a primary package only
having execute rights. Would you suggest a temporary table as the best
solution? If I am to create a temporary table is my understanding correct
that it has to be created as a Global Temporary Table first before I can
declare and use it withing my stored procedures?
Unlike in Oracle global temporary tables in DB2 or LUW are DECLARed.
That is you declare then in your session before exetuting the procedures.
My prepared approach is like this:
--#SET TERMINATOR @
CREATE PROCEDURE declare()
BEGIN
DECLARE GLOBAL TEMPORARY TABLE SESSION.TEMP(c1 INT);
END
@
CALL declare()
@
CREATE PROCEDURE P()
BEGIN
CALL declare();
INSERT INTO SESSION.TEMP VALUES 1, 2, 3;
END
@
--#SET TERMINATOR ;
.....
CALL P();
Note how I encapsulate the temp table declararion into an init procedure.
That procedure is called prior to the CREATEs which use the proc.
Cheers
Serge
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab