Re: Reading a temp table
Posted in 1998
iftikhar_khan@mailcity.com wrote: > > Hi Everybody > > I have a question on reading a temp table in Informix 4GL. In my Informix 4GL > code, I am taking some input from user and based on that input I am creating > a temp table and puting data into it from other tables. At any time this temp > table may have one or five or seven or as many columns as possible. Now I > want to read each column's data value. I am preparing a query (SELECT * FROM > myTempTable) and declaring a cursor for this query. Now I want a loop of > 'foreach' mycursor into ...... . But I donot have variables for into clause > because I donot know how many I need and of what type. How can I solve this > problem? Is there anyway of defining variables dynamically in Informix 4GL? > Please help. > > Thanks in advance for you time and help. > Regards, > Iftikhar > > -----== Posted via Deja News, The Leader in Internet Discussion ==----- > http://www.dejanews.com/ Now offering spam-free web-based newsreading An alternative to Catalin's method is to use variant records. Basically, you add a column to the temp table to identify what the (single) data column contains. The 4GL code then uses this to decide what to do. If the potential columns are of different type this can get messy. The SQL to create the temp table can also be messy and inefficient. -- Peter Lancashire Information Systems Specialist, Bayer plc Eastern Way, Bury St Edmunds, Suffolk, IP32 7AH, UK Tel: +44-1635-562258, Fax: +44-1635-562281 Mail: Peter.Lancashire.PL1@bayer.co.uk --- My Internet plumbing does not allow me to mail and post news together. Sorry. All opinions are my own and not those of Bayer plc. --- Join Infuse, the UK Informix User Group at http://www.infuse.org.uk/