user3059532
user3059532

Reputation: 1

ORA-00907 missing right parenthesis error + java

I have this procedure in sql:

PROCEDURE classificacao(csr OUT SYS_REFCURSOR, campeonato number, ttime VARCHAR2) AS
  sql_text VARCHAR2(600);
  BEGIN
    sql_text := 'SELECT ESTPRAT7.totaljogos('''||campeonato||''', '''||ttime||'''), ESTPRAT7.totalvitorias('''||campeonato||''', '''||ttime||'''), ESTPRAT7.totalempates('''||campeonato||''', '''||ttime||
    '''), ESTPRAT7.totalderrotas('''||campeonato||''', '''||ttime||'''), ESTPRAT7.totalpontos('''||campeonato||''', '''||ttime||'''), ESTPRAT7.aproveitamento('''||campeonato||''', '''||ttime||''') FROM DUAL';
    dbms_output.put_line(sql_text);
    OPEN csr FOR sql_text;
  END classificacao;

and it executes correctly. But when I try to execute in my JAVA program, keeps raising this error

Here is the java code:

OracleCallableStatement pesquisa = 
        (OracleCallableStatement) connection.prepareCall("{ call EstPrat7.classificacao( ?, "+n+", ? )}");
        pesquisa.registerOutParameter(1, OracleTypes.CURSOR);
        pesquisa.setString(2, time);
        pesquisa.execute();

Am I missing something?

Upvotes: 0

Views: 676

Answers (1)

Nick
Nick

Reputation: 575

Try printing the whole sql call. I see nothing faulty here, it's probably a wrong parameter in an unexpected format/with an unexpected symbol.

try

 System.out.println(pesquisa );

if that doesn't give you the sql output(and if I remember right the oracle driver didn't), you can use https://code.google.com/p/log4jdbc/ to see the sql output (or see the oracle query history).

Upvotes: 1

Related Questions