4GL question
Posted in 2004
Topics: Connectivity: ESQL/C, 4GL & Embedded SQL
This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_001_01C3E5AE.12223DD0 Content-Type: text/plain Hello all, I'm writing a 4GL report, and I need it to span several databases that all have matching tables and structures, it's just the info in the tables that's different. I know I could add the database name to the FROM statement in each of my selects, but I was hoping there was a way to do create a DATABASE statement using a variable name. That way I wouldn't have to change the SQL statements and add the CLOSE and FREE statements for each cursor and prep statement. TIA, Howard ------_=_NextPart_001_01C3E5AE.12223DD0 Content-Type: text/html <html> <head> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii"> <meta name=Generator content="Microsoft Word 10 (filtered)"> <style> <!-- /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {margin:0in; margin-bottom:.0001pt; font-size:12.0pt; font-family:"Times New Roman";} a:link, span.MsoHyperlink {color:blue; text-decoration:underline;} a:visited, span.MsoHyperlinkFollowed {color:purple; text-decoration:underline;} span.EmailStyle17 {font-family:Arial; color:windowtext;} @page Section1 {size:8.5in 11.0in; margin:1.0in 1.25in 1.0in 1.25in;} div.Section1 {page:Section1;} --> </style> </head> <body lang=EN-US link=blue vlink=purple> <div class=Section1> <p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'>Hello all,</span></font></p> <p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'> </span></font></p> <p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'>I'm writing a 4GL report, and I need it to span several databases that all have matching tables and structures, it's just the info in the tables that's different. I know I could add the database name to the FROM statement in each of my selects, but I was hoping there was a way to do create a DATABASE statement using a variable name. That way I wouldn't have to change the SQL statements and add the CLOSE and FREE statements for each cursor and prep statement.</span></font></p> <p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'> </span></font></p> <p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'>TIA,</span></font></p> <p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'> </span></font></p> <p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'>Howard</span></font></p> </div> </body> </html> ------_=_NextPart_001_01C3E5AE.12223DD0-- sending to informix-list
Howard Salter wrote: > This message is in MIME format. Don't post MIME - or I'll set the Clown onto you! > I'm writing a 4GL report, and I need it to span several databases that all > have matching tables and structures, it's just the info in the tables that's > different. I know I could add the database name to the FROM statement in > each of my selects, but I was hoping there was a way to do create a DATABASE > statement using a variable name. That way I wouldn't have to change the SQL > statements and add the CLOSE and FREE statements for each cursor and prep > statement. I'm not quite clear what you mean by 'I was hoping there was a way to do create a DATABASE statement using a variable name'. I suspect that you are asking for something like: FROM somevar:tablename AS t Where the somevar is an I4GL host variable. That's a non-starter; you can only specify values via variables, not table names - and dbase:tablename is still a table name even though it includes a database name too. Secondly, even if by some magic you could make the database name into a variable, you would still have to re-prepare (and re-declare, and re-open) the statement each time. > <meta name=Generator content="Microsoft Word 10 (filtered)"> Should be banned!! -- Jonathan Leffler #include <disclaimer.h> Email: jleffler@earthlink.net, jleffler@us.ibm.com Guardian of DBD::Informix v2003.04 -- http://dbi.perl.org/