/** * This procecure calls the following Oracle stored procedure which inserts a new row into the * JDBC_TEST table. * * <p>CREATE OR REPLACE PROCEDURE jdbc_proc_test1(pTEST_ID NUMBER, pNOTES VARCHAR2) IS BEGIN * INSERT INTO JDBC_TEST(TEST_ID, NOTES, TEST_DT, AMOUNT, CODE) VALUES (pTEST_ID, pNOTES, SYSDATE, * 44.44, 'Z'); END; / */ public static void testCallingStoredProc() { SQLExecutor sqlExec = new SQLExecutor(getConnectionPool()); sqlExec.addParam(new Integer(8)); sqlExec.addParam("This record inserted via stored proc call"); sqlExec.runStoredProcCloseCon("jdbc_proc_test1"); }
/** * This procedure calls the following Oracle stored procedure and gets the value from the OUT * param pFULLNAME. * * <p>CREATE OR REPLACE PROCEDURE jdbc_proc_test2( pFIRSTNAME IN VARCHAR2, pLASTNAME IN VARCHAR2, * pFULLNAME OUT VARCHAR2) IS BEGIN pFULLNAME := pFIRSTNAME || ' ' || pLASTNAME; END; */ public static void testCallingStoredProcWithAnOUTParam() { SQLExecutor sqlExec = new SQLExecutor(getConnectionPool()); sqlExec.addParam("Jeff"); sqlExec.addParam("Smith"); sqlExec.addStoredProcOutParam("fullname"); SQLResults res = sqlExec.runStoredProcCloseCon("jdbc_proc_test2"); System.out.println("Your full name is " + res.getString(0, 2)); System.out.println(res.toString()); }