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 |
*> 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 |