|
Dave, Why not have a template file created once and when used make a DUPOBJ in the required library (QTEMP in your example); similar to the *OUTFILE technique used with IBM supplied commands. And if you want to create a CSV file, why not run embedded SQL and write to the IFS directly, putting the field seperators in the proces? Regards, Carel Teijgeler *********** REPLY SEPARATOR *********** On 20-9-05 at 11:36 Smith, Dave wrote: >When I do a: > >CREATE TABLE QTEMP.TableName AS >( >SELECT Fields >FROM File >WHERE Fielda = :Variable >) with Data > >I get an error message that I can not use a host variable in this >statement. I tried it in both embedded RPG and in a SQL procedure. > >So instead I've been doing > >CREATE TABLE QTEMP.TableName AS >( >SELECT Fields >FROM File >) with No Data; > >INSERT INTO QTEMP.TABLENAME >SELECT Fields >FROM File >WHERE Fielda = :Variable > >Now I get my table with the data I need but I need to maintain my select >statement in two spots...On the CREATE TABLE and on the INSERT. >Anybody have a better method of using SQL to create a temporary file. >In this case I'm using an email package to email the file off in a CSV >file and then deleting the file.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.