This content has been marked as final.
Show 4 replies
-
1. Re: java.sql.SQLException: ORA-06550: line 1, column 28:PLS-00103: Encountered
Joe Weinstein-Oracle Aug 31, 2011 8:30 PM (in response to 856967)You're going to have to show your JDBC code. The
problem is going to be there. Continue this,
showing your JDBC code, in the basic JDBC forum:
forums.oracle.com/forums/forum.jspa?forumID=1050 -
2. Re: java.sql.SQLException: ORA-06550: line 1, column 28:PLS-00103: Encountered
856967 Aug 31, 2011 8:43 PM (in response to Joe Weinstein-Oracle)public void callProcedure(String value) throws SQLException {
if (paramName != null) {
// for (int i = 0; i < values.length; i++) {
// cstmt.setString(paramNames, values[i]);
cstmt.setString(paramName, value);
}
else {
System.out.println("paramName is null");
}
cstmt.execute();
}
/**
* Commits the current transaction.
*
* @throws SQLException
*/
public void commitTransaction() throws SQLException {
connMgr.commitTransaction(conn);
}
// @Override
// public void finalize() {
// connMgr.releaseConnection(conn);
// }
private static OracleCallableStatement prepareCall(OracleConnection conn,
String packageName,
String procedureName,
String paramName)
throws Exception {
String sql;
if (packageName == null || packageName.equals("")) {
sql = "{call " + procedureName + "(";
} else {
// sql = "{call " + packageName + "." + procedureName + "(";
sql = "{call " + packageName + "." + procedureName + "(";
}
if(paramName != null) {
sql += "?";
}
sql += ")}";
return (OracleCallableStatement)conn.prepareCall(sql);
}
Inside Integration.java
try{
String Opportunity = null;
Opportunity = OPPORTUNITY_NAME.getAccountName().toString();
System.out.println("oppty after converting to string is...."+Opportunity);
service.connMgr = ConnectionManager.getConnectionManager();
System.out.println("Got the connection to the database");
service.complete = new CallableStatementDAO("test2", "UpdateAAA", Opportunity);
}
catch (Exception e) {
e.printStackTrace();
System.out.println(e.getMessage());
}
there is no other code, just the two classes and some query in the backend -
3. Re: java.sql.SQLException: ORA-06550: line 1, column 28:PLS-00103: Encountered
856967 Aug 31, 2011 8:52 PM (in response to 856967)I took off most of the code at the DAOController
throws Exception {
String sql = null;
// if (packageName == null || packageName.equals("")) {
// sql = "{call " + procedureName + "(";
// } else {
// sql = "{call " + packageName + "." + procedureName + "(";
// sql = "{call " + packageName + "." + procedureName + "(";
// }
if(paramName != null) {
sql += "?";
}
// sql += ")}";
return (OracleCallableStatement)conn.prepareCall(sql);
}
and I get
java.sql.SQLException: Invalid column index
at oracle.jdbc.driver.OraclePreparedStatement.setStringInternal(OraclePreparedStatement.java:5303)
at oracle.jdbc.driver.OracleCallableStatement.setString(OracleCallableStatement.java:5939)
at oracle.jdbc.driver.OracleCallableStatementWrapper.setString(OracleCallableStatementWrapper.java:250)
at dao.CallableStatementDAO.callProcedure(CallableStatementDAO.java:62)
at integration.IntegrationService.main(IntegrationService.java:192) -
4. Re: java.sql.SQLException: ORA-06550: line 1, column 28:PLS-00103: Encountered
Joe Weinstein-Oracle Aug 31, 2011 9:03 PM (in response to 856967)print out the SQL string you actually create, in total, before you set parameters or execute it.
Also print out the index number you come up with for the setString() call. It will be good for
you to know that the index for parameters starts at one, not zero, and it doesn't look like
you're getting that right.