user2646294
user2646294

Reputation: 11

error when trying to execute pl/sql with callablestatement

I am having difficulties executing a pl/sql statement with jdbcs callablestatement. This is the error I'm getting:PL/SQL: ORA-00933: SQL command not properly ended`

And this is the statement:

DECLARE
BEGIN
 IF ('XXX' <> 'XXX')
 THEN
    update XXX set XXX=1 where XXX='XXX' and XXX like 'XXX'

 END IF;
END;
/

It runs fine in Oracle sql developer. I have tried removing "/" and the semicolon behing "END", but it does not work. Get the same error now matter what I do. The values have been replaced with "XXX" for this post.

Do any of you wise guys have some helpful insight?

Upvotes: 1

Views: 199

Answers (1)

Nick Krasnov
Nick Krasnov

Reputation: 27251

  1. Semicolon is missing after the UPDATE statement
  2. As you have no variables declared, DECLARE keyword is optional
  3. Be careful with and XXX like 'XXX'. using Like condition without wildcards is the same as using equality operator.
  4. You might consider using MERGE statement instead of this PL/SQL block.

Upvotes: 2

Related Questions