Re: OPENs and FOREACH
Posted in 1994
John G. Leipold (jleip@csci.csc.com) wrote: : I have one of those it does work but the manual says it shouldn't type of questions. : Consider the following sample code: : open curs1 using name : foreach curs1 into dis_name : display dis_name Yes, I have seen this work on RS/6000 and 4gl 4.1, but I don't use it and I don't recommend it, either. I examined the generated code and it appears that "open" is being called twice, once with parameters and once without. 4GL implements FOREACH as an open/fetch. The explicit OPEN statement was simply tacked on to the beginning. I believe the book says that an open will close an already opened cursor, so I suppose the question of whether or not this works is most likely a factor which version of the *engine* you are running, not 4gl. (We use both RS/6000 w/ Online 4.1 and Solaris w/ Online 5.0?) In any case, I avoid it. Why informix didn't just tack on a "using" clause to foreach is beyond me. By the way, one time I tried doing this with a cursor that needed two parameters and it didn't work. In other words: open c_rows using val1, val2 foreach c_rows into r_rows.* . . . Did not work for me. I don't remember why and I don't really care, anyway. Cheers, -- ------------------------------------------------------------ robert m. read tiggyr@netcom.com For PGP Public Key, finger tiggyr@netcom.com