|
Hi All,
I have a two tables from which I read from one table and write the
results to another. I changed my code to use a PREPARE statement, but
the system doesn't appear to write anything to the target table. Do I
need to do a FETCH command into a variable in order to write to the
table? If so, how would I get it to write to the other table?
Here's the snippet of code:
/free
SQLMlist = 'insert into sswdppp (';
SQLMlist = SQLMlist + 'select pskdl1, pskdl2, pskdl3, psyear, psmdl,';
SQLMlist = SQLMlist + ' pstyp, psexcl,psinbt, psuqty';
SQLMlist = SQLMlist + ' from sst25 where concat(PSKDL2, PSKDL3) ';
SQLMlist = SQLMlist + ' between ' + apos + shortyy + cmm + apos;
SQLMlist = SQLMlist + ' AND '+ apos + nextsyy + nmm + apos + ')';
/end-free
C/Exec SQL
C+ PREPARE SQL2 FROM :SQLMlist
C/End-exec
C*
C/Exec SQL
C+ DECLARE C2 CURSOR for SQL2
C/End-exec
C*
C/Exec SQL
C+ OPEN C2
C/End-exec
C*
C* Do I need to add another /EXEC SQL here???
C*
C/Exec SQL
C+ Close C2
C/End-exec
C*
C/Exec SQL
C+ commit
C/End-exec
Another question I have is if I can compress the /Exec SQL lines down,
or must they remain on separate lines?
Thank you!
Brian.
-=-=-=-=-=-=-=-=-=-=-=-=-=-
Brian Piotrowski
Specialist - I.T.
Simcoe Parts Service, Inc.
Ph: 705-435-7814 x343
Fx: 705-435-6746
bpiotrowski@xxxxxxxxxxxxxxx
-=-=-=-=-=-=-=-=-=-=-=-=-=-
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.