Re: *** Cursor - Opening and Closing ***
Date: 12 May 1994 02:55:24 GMT
Message-ID: <2qs5qs$iiv_at_nntp2.Stanford.EDU>
In article <1994May11.014239.26696_at_cc.gatech.edu>, badri_at_cc.gatech.edu (badri) writes:
|> Dear Friends:
|>
|> Can I do the following in a Pro*C program?:
|>
|> strcpy (sqlcmd, "insert into ...");
|>
|> EXEC SQL DECLARE C1 CURSOR FOR sqlcmd;
|>
|> EXEC SQL OPEN C1;
|>
|> .......
|>
|> EXEC SQL CLOSE C1;
|>
|> I get the following error when I tried some-
|> thing like this:
|>
|> Precompiling test.pc
|> 127 EXEC SQL DECLARE C3 CURSOR FOR sqlcmd;
|> 127 .......................................^
|> PCC-S-0014: Undeclared SQL Identifier "C3" at
|> line 127 in file test.pc
|>
|> Please excuse me if this is a FAQ.
|>
|> Thanks in advance,
|>
|> -Badri
You can do this, but not this way. You need to use dynamic method 3:
EXEC SQL PREPARE S from :sqlcmd;
EXEC SQL DECLARE C CURSOR FOR S; EXEC SQL OPEN C; ...
EXEC SQL CLOSE C; See the precompilers manual, the chapter on dynamic methods. Received on Thu May 12 1994 - 04:55:24 CEST