Re: Cursor not found
Posted in 1998
In article <3674188A.689417C9@ix.netcom.com>, Ed Schaefer <olded@ix.netcom.com> writes >Hi Alvan: > >I don't know if this is your problem, but you're not declaring the x cursor >"with hold", so if the informix 4GL code is written with a loop construct, >the commit work will close the x cursor after one iteration. > >regards, > >Ed >Schaefer > >"Alvan Rowland Jr." wrote: > >> I hope that you will be able to help me. >> I am using Informix-SQL and Informix 4GL 7.20.UD1 and I have come across >> an error... or at least I believe it to be an error. I have a test >> program that looks like the following. >> >> database >> tis >> main >> define >> str char(200), >> up_str char(200), >> y integer >> >> let str = "select * from account for update" >> >> prepare ex_str from str >> >> declare x for ex_str >> >> let up_str = "update account set account_num = ? where current of x" In 4GL version 6.01 and above cursor names get 'mangld' so that they are unique to the whole program not just the individual module. i.e. cursors are gloabl now!! Hence this will not work since the cursor name is not x but something like sdfasdfas_123123!! Fortunately a bug was logged against 6.00 and 6.01 provideds a CURSOR_NAME function... Hence change this to let up_str = "update account set account_num = ? where current of", CURSOR_NAME("x") and it should work (or compile with the -globcurs option to c4gl). Check the FAQ for more info (www.smooth1.demon.co.uk) >> >> prepare ex_up_str from up_str >> >> begin work >> >> open x >> >> fetch x into y >> >> execute ex_up_str using y >> >> commit work >> end main >> >> Please ignore any syntax errors. Essentially accounts has one column >> that is an integer. This database has transaction lgging turned on, but >> when it is executed it gives a: Cursor (x) not found. error message. >> >> Any suggestions?! > -- David Williams