Sintax error, rule partially recognized PL / SQL


I find myself performing a simple procedure in PL/SQL to practice receiving an entry and exit number and increasing it each time it is executed. The code is like this.

CREATE PROCEDURE sumauno(suma in out int)
SET suma=suma+1;

in the "SET suma=suma+1" statement, I get a syntax error in the first suma . And I'm not understanding why.

Thank you very much everyone

asked by andres ribeiro 23.11.2018 в 17:57

1 answer


Your error is in the use of the reserved word set and the operator = . Are you ready to program in TSQL ?

In PL/SQL , to assign the value to a variable, you do not need to use any reserved word. The assignment operator is := , the = is a comparison operator, as in the standard SQL .

So, I think what you want to do is this:

suma := suma + 1;

The reserved word set exists, and it is used within a update statement, or, when you are in SQL * plus , to assign values to the system variables ,

answered by 23.11.2018 в 18:53