Re: Invalid character???

From: Laurenz Albe <invite_at_spam.to.invalid>
Date: 20 Aug 2008 07:41:24 GMT
Message-ID: <1219218081.875385@proxy.dienste.wien.at>


Tim Slattery <Slattery_T_at_bls.gov> wrote:
> I'm at a total impasse. I have a stored function that returns a
> SYS_REFCURSOR. It works fine, I can call it in SQL*Plus and see the
> data that's been extracted. I'm trying to call it from Java:
>
> String spName;
> try
> {
> getDBConnection(); /* sets "dbConnection */
>
> spName = "{ call ? := getReporterData(?) }";
>
> sprocStmt = dbConnection.prepareCall(spName);
> sprocStmt.registerOutParameter(1, OracleTypes.CURSOR);
> sprocStmt.setString(2, key);
> sprocStmt.execute();
>
> And I get ORA-00911 Invalid character. What invalid character?

According to the documentation, the syntax is wrong, see http://download-uk.oracle.com/docs/cd/B19306_01/java.102/b14355/basic.htm#i1008346

They have two samples:

// SQL-92 syntax
conn.prepareCall("{? = call func (?,?)}");

// PL/SQL anonymous block
conn.prepareCall("begin ? := func(?,?); end;");

But you shouldn't mix these two.

Yours,
Laurenz Albe Received on Wed Aug 20 2008 - 02:41:24 CDT

Original text of this message