-
-
Save jonbartlett/175145 to your computer and use it in GitHub Desktop.
Call PL/SQL from Java /OAF
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import oracle.jdbc.OracleCallableStatement; | |
import oracle.sql.NUMBER; | |
import java.sql.*; | |
import java.sql.Connection; | |
OracleCallableStatement stmt = null; | |
try { | |
OADBTransaction trx = oaapplicationmodule.getOADBTransaction(); | |
String sqlStmt = "begin vpc_icms_cash_flow.p_create_new_version(?,?); end;"; | |
Connection connection = oaapplicationmodule.getOADBTransaction().getJdbcConnection(); | |
stmt = (OracleCallableStatement) connection.prepareCall(sqlStmt); | |
stmt.setNUMBER(1, new NUMBER(contractId, 0)); // Bind 1st parameter | |
stmt.setNUMBER(2, new NUMBER(contractVerNum, 0)); // Bind 2nd parameter | |
stmt.execute(); | |
} catch (SQLException e) { | |
if (flag) { | |
oapagecontext.writeDiagnostics(this, "VPC: Exception:" + e, 1); | |
} | |
} finally { | |
try { | |
if (stmt != null) { | |
stmt.close(); // close the statement | |
} | |
} catch (SQLException ex) { | |
if (flag) { | |
oapagecontext.writeDiagnostics(this, "VPC: Exception2:" + ex, 1); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment