Raj-
Thanks so much for your help. I have gotten the compile to work. It
appears to be my lack of knowleddge of CLP/statement terminator
behavior and a misleading sqlcode that are the issues.
If I could ask you for one more favor, could you help me understand the
CLP options you used so that I can integrate DROP and GRANT statements
into what I'm submitting via CLP?
In effect, I want to do this:
DROP PROCEDURE DVLXTRCT_TEST_ECHO_SP2
;
CREATE PROCEDURE DVLXTRCT_TEST_ECHO_SP2
(IN P_ECHO_TEXT CHARACTER(50)
)
DYNAMIC RESULT SETS 1
LANGUAGE SQL
NOT DETERMINISTIC
CALLED ON NULL INPUT
READS SQL DATA
INHERIT SPECIAL REGISTERS
pgm: begin
DECLARE c1 CURSOR WITH RETURN TO CALLER FOR
values(P_Echo_Text)
;
-- to return result set, do not CLOSE cursor
OPEN c1;
end;
GRANT EXECUTE ON PROCEDURE DVLXTRCT_TEST_ECHO_SP2 TO PUBLIC
@
When I do, I get the following:
--> db2 -td@ -vsf dvlxtrct.pete_test_proc.ddl
GRANT EXECUTE ON PROCEDURE DVLXTRCT_TEST_ECHO_SP2 TO PUBLIC
DB21034E The command was processed as an SQL statement because it was
not a
valid Command Line Processor command. During SQL processing it
returned:
SQL0104N An unexpected token "DROP PROCEDURE DVLXTRCT_TEST_ECHO_SP2
;" was
found following "BEGIN-OF-STATEMENT". Expected tokens may include:
"<space>". SQLSTATE=42601
It's clear I have to dig into the CLP environment and educate myself,
but GREATLY appreciate your help!
Pete H
===========================================
> This is the proc.sql
> ----------------------
[quoted text clipped - 17 lines]
> ----------------------------------------
> the statement i used to compile: db2 -td@ -vsf proc.sql
Serge Rielau - 30 Aug 2006 15:05 GMT
> Raj-
> Thanks so much for your help. I have gotten the compile to work. It
> appears to be my lack of knowleddge of CLP/statement terminator
> behavior and a misleading sqlcode that are the issues.
Let's fix this at the root.
At the very first line of your CLP script please add:
--#SET TERMINATOR @
Now all statements will be assumed completed when you type @:
CREATE TABLE T(c1 INT)@
CREATE PROCEDURE P(OUT a INT)
BEGIN
SET a = 5;
END@
....
If you want to change the terminator back to ; just type:
--#SET TERMINATOR ;
Now you can use db2 -t <filename>
Cheers
Serge

Signature
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
IOD Conference
http://www.ibm.com/software/data/ondemandbusiness/conf2006/
peteh - 30 Aug 2006 16:11 GMT
Hi Serge;
Excellent! Thanks very much. Once again you have saved me from pulling
my (my ever-receding) hair out.
Pete H
> > Raj-
> > Thanks so much for your help. I have gotten the compile to work. It
[quoted text clipped - 28 lines]
> IOD Conference
> http://www.ibm.com/software/data/ondemandbusiness/conf2006/