Re: OPENs and FOREACH
Posted in 1994
jleip@csci.csc.com (John G. Leipold) writes: >I have one of those it does work but the manual says it shouldn't type of questions. >Consider the following sample code: >database xxxx >main > define str CHAR(300) > define name char(20) > define dis_name like table.name > let name = "PARKER" > let str = "select name from table where name = ? " > prepare command from str > declare curs1 cursor with hold for command > open curs1 using name > foreach curs1 into dis_name > display dis_name > end foreach >end main >Of course you would change database and table names to work on your system. >The above sample brings out all rows with the name "PARKER". The manual says >that a FOREACH has an implied open and cannot be used with a sql statement that >will require parameters. The OPEN section of the manual says the same thing. >The program is running on HP 9000 / Online 5.0. I have also seen this code >run on IBM RS/6000 Online 5.0? >The real question is: > > Will I have any problems moving this code to earlier versions of > Informix? I think maybe. I vaguely recall a customer doing the same sort of thing about two years ago, and having the code break when they ported to a different box. As I recall, they were running 4.0/4.1 4GL. This type of functionality was a feature request back then (and may have been implemented with your versions), but I would be wary of it. ============================================================ Dennis J. Pimple Senior Consulting Services Engineer Informix Software Inc Denver Colorado USA dennisp@informix.com Voice:303-850-0210 Fax:303-779-4025