1.

How Do I Call Oracle Stored Procedures That Take No Parameters?

Answer»

Here is what we use that WORKS:

CallableStatement cstmt = conn.prepareCall("Begin procName;
END;");
cstmt.execute();

where procName is the name of an ORACLE stored procedure. This is standard Oracle SQL syntax that works with any Oracle DBMS.

You MIGHT also use the following syntax:

CallableStatement cstmt = conn.prepareCall("{call procName};");
cstmt.execute();

This code, which conforms to the JAVA EXTENDED SQL spec, will work with any DBMS, not just Oracle.

Here is what we use that works:

CallableStatement cstmt = conn.prepareCall("Begin procName;
END;");
cstmt.execute();

where procName is the name of an Oracle stored procedure. This is standard Oracle SQL syntax that works with any Oracle DBMS.

You might also use the following syntax:

CallableStatement cstmt = conn.prepareCall("{call procName};");
cstmt.execute();

This code, which conforms to the Java Extended SQL spec, will work with any DBMS, not just Oracle.



Discussion

No Comment Found