Search code examples
oracle-databasejdbcprocedure

JDBC call procedure , occur non supported SQL92


    callStmt= conn.prepareCall("{call get_id(?,?,?);}");
    callStmt.setString(1,"T_CUSTOMER");
    callStmt.registerOutParameter(2,Types.VARCHAR);
    callStmt.setString(3,"GD");
    callStmt.execute();
    String string = callStmt.getString(2);
    System.out.println(string);

I search in google and found this error occurs may because of "{}", But how can I call a oracle procedure without "{}" ? or which token should I use ?


Solution

  • The braces won't work for Oracle. Take them out and you should be good to go. Oracle traditionally uses placeholders that being with the character ':' followed by a word.

    If you don't like the call keyword, you can use this: "BEGIN get_id(?,?,?); END;"