Re: FOREACH syntax error
Posted in 1995
Topics: General Discussion
Jack Parker (jparker@hpbs3645.boi.hp.com) wrote: : Interesting problem (at least to me). I have a cursor: : DECLARE ct_curs CURSOR FOR : SELECT filename, colname, coltype, collength : FROM source_tables, source_columns : WHERE source_tables.file_id = source_columns.file_id : AND source_tables.end_date IS NULL : ORDER BY filename, colname : and a simple FOREACH loop; : LET c_idx = 1 : FOREACH ct_curs INTO col_rec[c_idx].tabname, col_rec[c_idx].colname, : col_rec[c_idx].coltype, col_rec[c_idx].collength : LET col_rec[c_idx].tag = '' : LET c_idx = c_idx + 1 : IF c_idx > 1000 THEN : EXIT FOREACH : END IF : END FOREACH : This works fine by itself. When I use the same code in a bigger and finer : program I get a -201 syntax error on the FOREACH. Checking the .ec code : it appears that it doesn't like trying to open the cursor. : Obviously there is some piece of code nested in the 4000+ odd lines that is : causing this problem. I have no idea what it is. My standard debugging : technique involves ripping things out until the pain stops. Does this : ring a bell for anyone? In other words does anyone have some idea what : I should be looking for? : (I've already checked DATABASE statements - no joy). : adv(thanks)ance : j. : _____________________________________________________________________________ : Jack Parker - Hewlett Packard, DMD/IS Boise, Idaho, USA : jparker@hpbs3645.boi.hp.com : _____________________________________________________________________________ This happened to me when my table alias names were the same as my record names. Michael Reed, Radiix, Inc. 3588 Plymouth Rd. Ste 257 Ann Arbor, MI 48108 v: 313-677-UNIX, e: mreed@radiix.com