EXEC SQL [ AT Database ] [ FOR Iterations ] EXECUTE Prepared-Statement [ USING Host-Variable, ... ] [ INTO Host-Variable, ... ] END-EXEC |
EXEC SQL [ AT Database ] [ FOR Iterations ] EXECUTE IMMEDIATE Statement [ USING Host-Variable, ... ] [ INTO Host-Variable, ... ] END-EXEC |
EXEC SQL [ AT Database ] EXECUTE {BEGIN } [Plsql] {DECLARE } END-EXEC |
EXEC SQL [ AT Database ] EXECUTE Prepared-Statement [ { USING DESCRIPTOR } Sql-Descriptor ] { INTO DESCRIPTOR } END-EXEC |
import com.iscobol.types.CobolVar; import com.iscobol.rts.EsqlPrepareHandler; public class MyQueryHandler implements EsqlPrepareHandler { public void queryDecoder(CobolVar query) { String newQuery = query.toString(); // alter the newQuery string as you wish query.set(newQuery); } } |
iscobol.esql.prepare_handler=MyQueryHandler |
*> count_recs does not need to be defined prior to *> their use in the prepare statement *> min-key and the-count could be pic 9(4) each exec sql prepare count_recs from "select count(*) from cust_table where cust_code > ?" end-exec move 1990 to min-key exec sql execute count_recs using :min-key into :the-count end-exec display "Count of records with key > " min-key " : " the-count |
move 1990 to min-key exec sql execute immediate "select count(*) from cust_table where cust_code > ?" using :min-key into :the-count end-exec display "Count of records with key > " min-key " : " the-count |
exec sql execute DECLARE bonus REAL; BEGIN FOR emp_rec IN (SELECT empno, sal, comm FROM emp) LOOP bonus := (emp_rec.sal * 0.05) + (emp_rec.comm * 0.25); INSERT INTO bonuses VALUES (emp_rec.empno, bonus); END LOOP; COMMIT; END; end-exec |