Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.tools -> Re: What is the precise syntax to call stored procedure?
Hi Jacob. The standard JDBC form for calling procedures is:
Statement st = conn.prepareCall("{ CALL PROC1() }"); // note the () to denote zero params st.execute();
Let me know if this helps. To simplfy the issue, create the procedure through SQL-PLUS, logging in as the same user as yo log in via JDBC. Then just run the above code in JDBC.
Joe Weinstein at BEA
Jacob Nikom wrote:
>
> Hi,
>
> I am trying to figure out the precise syntax to call stored procedure
> suing Java and
> Oracle database. I was able to create the store procedure using the
> following snippet
> and verified it with SQLplus tool:
>
> String createProcedure = "CREATE OR REPLACE PROCEDURE PROC1 "+
> "AS " +
> "BEGIN " +
> "INSERT INTO URDB_TEST VALUES " +
> "( " +
> "'stored str'," +
> "111," +
> "11111," +
> "111111," +
> "4.12," +
> "3.62," +
> "1 " +
> "); end";
>
> createStatement ();
> executeUpdate (createProcedure);
> closeStatement ();
>
> To call the stored procedure I used the syntax from Sun's tutorial:
> prepareCall ("{ CALL PROC1 }");
> execute();
>
> and it always produced error message:
>
> SQLException: ORA-06550: line 1, column 7:
> PLS-00905: object RMA.PROC1 is invalid
> ORA-06550: line 1, column 7:
> PL/SQL: Statement ignored
>
> SQLState: 65000
> SQLVendorError: 6550
>
> I could not find any specific example how to call the stored procedure
> for Oracle database and Java. I know that Oracle is different, but how?
>
> I would appreciate any help,
>
> Jacob Nikom
-- PS: Folks: BEA WebLogic is in S.F., and now has some entry-level positions for people who want to work with Java and E-Commerce infrastructure products. Send resumes to joe_at_beasys.com -------------------------------------------------------------------------------- The Weblogic Application Server from BEA JavaWorld Editor's Choice Award: Best Web Application Server Java Developer's Journal Editor's Choice Award: Best Web Application Server Crossroads A-List Award: Rapid Application Development Tools for Java Intelligent Enterprise RealWare: Best Application Using a Component Architecture http://www.bea.com/press/awards_weblogic.htmlReceived on Wed Sep 20 2000 - 00:00:00 CDT