int main() { otl_connect::otl_initialize(); // initialize OCI environment try{ db.rlogon("scott/tiger"); // connect to Oracle otl_cursor::direct_exec (db, "CREATE OR REPLACE PACKAGE pkg_test IS " " TYPE my_numeric_table IS TABLE OF NUMBER INDEX BY BINARY_INTEGER; " " TYPE my_varchar_table IS TABLE OF VARCHAR2(31) INDEX BY BINARY_INTEGER; " " TYPE my_char_table IS TABLE OF CHAR(31) INDEX BY BINARY_INTEGER; " " " " PROCEDURE prc_test(v1 IN OUT my_numeric_table, " " v2 OUT my_varchar_table, " " v3 OUT my_char_table); " " " "END; " ); otl_cursor::direct_exec (db, "CREATE OR REPLACE PACKAGE BODY pkg_test IS " " " " PROCEDURE prc_test(v1 IN OUT my_numeric_table, " " v2 OUT my_varchar_table, " " v3 OUT my_char_table) " " IS " " BEGIN " " FOR i IN 1..v1.last LOOP " " v1(i) := v1(i)+100; " " END LOOP; " " v1(v1.last+1) := 0; " " v2(1) := 'Hello'; " " v2(2) := 'World'; " " v2(3) := '!!!'; " " v3(1) := 'Hello'; " " v3(2) := 'World'; " " v3(3) := '!!!'; " " END; " " " "END; " ); plsql(); } catch(otl_exception& p){ // intercept OTL exceptions cerr<<p.msg<<endl; // print out error message cerr<<p.stm_text<<endl; // print out SQL that caused the error cerr<<p.var_info<<endl; // print out the variable that caused the error } db.logoff(); // disconnect from Oracle return 0; }