Please Help Me!!!!!!!
Posted in 1999
Topics: Connectivity: ESQL/C, 4GL & Embedded SQL
I have embedded SQL in C program on SUN OS. I am executing following Queries. Connect to database Prepare a cursor A{ Select from two tables and putting the result into a temporary table using INTO TEMP xyz } Prepare another cursor B { select from ... where field as in (from temp table xyz) } Declare B When i execute this in debugger till PREPARE A works fine. When PREPARE B is excuted i get sqlca code 206 which means table not in database. When A is executed works fine and then when B is executed it gives error 404 -cursor specification can not be executed. Anybody can tell me how to use TEMP TABLE in second query. I am not closing the databse nor freeing before its use. Thanks in advance Please mail me at - ajay@zebra.net
You don't need to use cursor for select ... into temp. You can simple write $SELECT something FROM sourcetable WHERE conditions INTO TEMP desttable -- Andrew Svikhnushin Inist Ltd. E-mail: san@inist.ru ajay <ajay@zebra.net> wrote in message news:3772EF50.2844@zebra.net... > I have embedded SQL in C program on SUN OS. > I am executing following Queries. > > Connect to database > Prepare a cursor A{ > Select from two tables and putting the result into a > temporary table using INTO TEMP xyz } > Prepare another cursor B { > select from ... where field as in (from temp table xyz) > } > Declare B > > When i execute this in debugger till PREPARE A works fine. > When PREPARE B is excuted i get sqlca code 206 which means > table not in database. > When A is executed works fine and then when B is executed > it gives error 404 -cursor specification can not be executed. > > Anybody can tell me how to use TEMP TABLE in second query. > I am not closing the databse nor freeing before its use. > > Thanks in advance > Please mail me at - > ajay@zebra.net