|
it can be done with the following steps c/Exec SQL c+ declare s1 statement c/End-Exec c/Exec SQL c+ declare c1 cursor for s1 c/End-Exec c/Exec SQL c+ declare c2 cursor for c+ select * from File A c/End-Exec c/Exec SQL c+ open C2 c/End-Exec loop thru the cursor 2 with *) c/Exec SQL c+ fetch next from C2 into :fNam c/End-Exec build the string with c eval SqlStmt = 'select ' + fNam for the first and c eval SqlStmt = SqlStmt + ', ' + fNam for the rest (SqlStmt declared as varying) c/Exec SQL c+ close C2 c/End-Exec now complete the statement c eval SqlStmt = SqlStmt + ' from FileB' now prepare the statement c/Exec SQL c+ prepare s1 from :SqlStmt c/End-Exec now open the cursor 1 c/Exec SQL c+ open c1 c/End-Exec now do whatever you want *) you can do a multiple row fetch into an array and loop thru the array here --------------------------- Dipl.Inf.(FH) Rolf P Mittag IBM Partner in Development Leipziger Str. 50 D-69214 Eppelheim Fon: +49 (6221) 76 78 60 Fax: +49 (6221) 76 80 26 eMl: rm@r-m-e-d-v.de
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.