trying to execute dynamic sql using values/into with marker inside select
<code> DCL-DS GroupDS;
wGrpSOAId Packed(7:0);
wAttach Packed(7:0);
wNotAttach Packed(7:0);
End-Ds;
wFrom1 = 'FROM TBL1.ADD';
//Build 'Group counts' SQL statements
wSQL1 = 'SELECT ID, ' +
' sum(Case when status=''A'' then 1 else 0 end), ' +
' sum(Case when status=''R'' then 1 else 0 end) ' +
' INTO :GroupDS '
+ %Trim(wFrom1) +
' WHERE ID = ? ' +
' GROUP BY ID'''
Exec Sql prepare @GrpSql from :wSQL1;
Exec Sql Execute @GrpSql using :wID;
</code>
<code> DCL-DS GroupDS;
wGrpSOAId Packed(7:0);
wAttach Packed(7:0);
wNotAttach Packed(7:0);
End-Ds;
wFrom1 = 'FROM TBL1.ADD';
//Build 'Group counts' SQL statements
wSQL1 = 'SELECT ID, ' +
' sum(Case when status=''A'' then 1 else 0 end), ' +
' sum(Case when status=''R'' then 1 else 0 end) ' +
' INTO :GroupDS '
+ %Trim(wFrom1) +
' WHERE ID = ? ' +
' GROUP BY ID'''
Exec Sql prepare @GrpSql from :wSQL1;
Exec Sql Execute @GrpSql using :wID;
</code>
DCL-DS GroupDS;
wGrpSOAId Packed(7:0);
wAttach Packed(7:0);
wNotAttach Packed(7:0);
End-Ds;
wFrom1 = 'FROM TBL1.ADD';
//Build 'Group counts' SQL statements
wSQL1 = 'SELECT ID, ' +
' sum(Case when status=''A'' then 1 else 0 end), ' +
' sum(Case when status=''R'' then 1 else 0 end) ' +
' INTO :GroupDS '
+ %Trim(wFrom1) +
' WHERE ID = ? ' +
' GROUP BY ID'''
Exec Sql prepare @GrpSql from :wSQL1;
Exec Sql Execute @GrpSql using :wID;
Is it possible to put this query inside values/into?
something like VALUES(wSQL1 or the actual select) INTO ?,?,?
I have not found any examples of this or do I need to use cursor?