Unix Technical Forum

Invalid character???

This is a discussion on Invalid character??? within the Oracle Miscellaneous forums, part of the Oracle Database category; --> I'm at a total impasse. I have a stored function that returns a SYS_REFCURSOR. It works fine, I can ...


Go Back   Unix Technical Forum > Database Server Software > Oracle Database > Oracle Miscellaneous

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 08-20-2008, 07:12 AM
Tim Slattery
 
Posts: n/a
Default Invalid character???

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?

--
Tim Slattery
Slattery_T@bls.gov
http://members.cox.net/slatteryt
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 08-20-2008, 07:12 AM
Malcolm Dew-Jones
 
Posts: n/a
Default Re: Invalid character???

Tim Slattery (Slattery_T@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?

What are the { } braces for in the SQL statement ?

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 08-20-2008, 07:12 AM
Vladimir M. Zakharychev
 
Posts: n/a
Default Re: Invalid character???

On Aug 19, 12:23*am, Tim Slattery <Slatter...@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?
>
> --
> Tim Slattery
> Slatter...@bls.govhttp://members.cox.net/slatteryt


Shouldn't this be spName = "{ ?= call getReporterData(?) }"; ? At
least if you're using JDBC escape syntax... Otherwise it can be spName
= "BEGIN ? := getReporterData(?); END;", in this case it'll be Oracle-
specific.

Hth,
Vladimir M. Zakharychev
N-Networks, makers of Dynamic PSP(tm)
http://www.dynamicpsp.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 08-20-2008, 07:12 AM
Tim Slattery
 
Posts: n/a
Default Re: Invalid character???

yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones) wrote:

>Tim Slattery (Slattery_T@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?
>
>What are the { } braces for in the SQL statement ?


That's JDBC syntax, it's not the problem.

<Sigh>....the java folks thought maybe the colon before the equal sign
was the problem. That's not it either.

--
Tim Slattery
Slattery_T@bls.gov
http://members.cox.net/slatteryt
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 08-20-2008, 07:12 AM
Tim Slattery
 
Posts: n/a
Default Re: Invalid character???

"Vladimir M. Zakharychev" <vladimir.zakharychev@gmail.com> wrote:

>Shouldn't this be spName = "{ ?= call getReporterData(?) }"; ? At
>least if you're using JDBC escape syntax... Otherwise it can be spName
>= "BEGIN ? := getReporterData(?); END;", in this case it'll be Oracle-
>specific.


I don't think so, I have ample documentation for :=. And I've tried it
without the colon and gotten the same result.

FWIW, I've tried the Oracle syntax (begin...end) and also gotten an
error: expression is of wrong type. I don't understand that one
either.

--
Tim Slattery
Slattery_T@bls.gov
http://members.cox.net/slatteryt
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 08-21-2008, 10:59 PM
Laurenz Albe
 
Posts: n/a
Default Re: Invalid character???

Tim Slattery <Slattery_T@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/c...c.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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 08-21-2008, 10:59 PM
Vladimir M. Zakharychev
 
Posts: n/a
Default Re: Invalid character???

On Aug 19, 8:31*pm, Tim Slattery <Slatter...@bls.gov> wrote:
> "Vladimir M. Zakharychev" <vladimir.zakharyc...@gmail.com> wrote:
>
> >Shouldn't this be spName = "{ ?= call getReporterData(?) }"; ? At
> >least if you're using JDBC escape syntax... Otherwise it can be spName
> >= "BEGIN ? := getReporterData(?); END;", in this case it'll be Oracle-
> >specific.

>
> I don't think so, I have ample documentation for :=. And I've tried it
> without the colon and gotten the same result.
>
> FWIW, I've tried the Oracle syntax (begin...end) and also gotten an
> error: *expression is of wrong type. I don't understand that one
> either.
>
> --
> Tim Slattery
> Slatter...@bls.govhttp://members.cox.net/slatteryt


JDBC docs suggest otherwise and your syntax does not look correct:
assignment to the return variable should precede the CALL keyword, not
follow it (" ?= call <procname>", not "call ?= <procname>" as in your
example.) Anyway, which statement throws the error? prepareCall() or
execute(), or maybe one of the binds? I don't see where you declare
sprocStmt either - is it a CallableStatement or an
OracleCallableStatement? And what's the function prototype? Is it's
argument indeed a VARCHAR2?

You see, my crystal ball is malfunctioning lately, so the more input
you give, the more chances there are we will be able to help you
pinpoint the source of the problem and fix it.

Regards,
Vladimir M. Zakharychev
N-Networks, makers of Dynamic PSP(tm)
http://www.dynamicpsp.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 08-21-2008, 10:59 PM
Tim Slattery
 
Posts: n/a
Default Re: Invalid character???

"Vladimir M. Zakharychev" <vladimir.zakharychev@gmail.com> wrote:

>JDBC docs suggest otherwise and your syntax does not look correct:
>assignment to the return variable should precede the CALL keyword, not
>follow it (" ?= call <procname>", not "call ?= <procname>" as in your
>example.)


Oh geez, you're right, of course. My typing here was sloppy. I do have
it correct in the code: { call ? := getReporterData(?) }

> Anyway, which statement throws the error? prepareCall() or
>execute(), or maybe one of the binds? I don't see where you declare
>sprocStmt either - is it a CallableStatement or an
>OracleCallableStatement? And what's the function prototype? Is it's
>argument indeed a VARCHAR2?


execute throws the error. I've never heard of
"OracleCallableStatement", the examples I've seen use
"CallableStatement", and that's what sprocStmt is.

I just tried "OracleCallableStatement" in my code. Now when I call the
PrepareStatement method of the connection object, I get told that it's
returning the wrong thing, namely a CallableStatement object that it's
trying to stuff into an OracleCallableStatement object.

The argument to getReporterData is char.

>You see, my crystal ball is malfunctioning lately, so the more input
>you give, the more chances there are we will be able to help you
>pinpoint the source of the problem and fix it.


Absolutely, I've said the same to many posters in other groups (where
I actually have a clue as to the subject matter)!

--
Tim Slattery
Slattery_T@bls.gov
http://members.cox.net/slatteryt
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 08-21-2008, 10:59 PM
Tim Slattery
 
Posts: n/a
Default Re: Invalid character???

"Vladimir M. Zakharychev" <vladimir.zakharychev@gmail.com> wrote:


>> >Shouldn't this be spName = "{ ?= call getReporterData(?) }"; ? At
>> >least if you're using JDBC escape syntax... Otherwise it can be spName
>> >= "BEGIN ? := getReporterData(?); END;", in this case it'll be Oracle-
>> >specific.


Just looked back in the thread. My original post had the syntax
correct, I don't know where it got inverted.

--
Tim Slattery
Slattery_T@bls.gov
http://members.cox.net/slatteryt
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 08-21-2008, 10:59 PM
Tim Slattery
 
Posts: n/a
Default Re: Invalid character???

Laurenz Albe <invite@spam.to.invalid> wrote:

>They have two samples:
>
>// SQL-92 syntax
>conn.prepareCall("{? = call func (?,?)}");
>
>// PL/SQL anonymous block
>conn.prepareCall("begin ? := func(?,?); end;");


I've tried both, I get illegal character from the first and something
about illegal type from the second. Neither works.

--
Tim Slattery
Slattery_T@bls.gov
http://members.cox.net/slatteryt
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads for: Invalid character???

Thread Thread Starter Forum Replies Last Post
mod_security: Invalid character detected [252] Carlos Molina Garcia mod_security Module 1 08-15-2008 07:18 PM
9 character passwords invalid? Christopher L. Barnard Sun Managers 1 06-29-2008 10:38 AM
invalid multibyte character for locale Anjan Dave pgsql Admins 0 04-10-2008 06:46 AM
Invalid character in numeric input <character> Eugene Turin pgsql Databases 1 04-10-2008 12:51 AM
bcp and invalid character value set Pascal Haddad MS SQL ODBC 1 02-27-2008 09:52 PM


All times are GMT. The time now is 08:51 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com