Stored procedure with UPDATE

3

I have this procedure where I want to add 1 to the "CONSECUTIVE" numeric field but it gives me an error how could I do it?

The error says: Syntax error, a NAME or EXPR was expected

create or replace PROCEDURE get_secuencia(consec OUT NUMBER)
AS
BEGIN
   consec:= UPDATE EQUIVALENTES_CONSECUTIVO SET CONSECUTIVO = CONSECUTIVO + 1;       
END;
    
asked by Saul Salazar 21.08.2018 в 18:25
source

1 answer

2

Try it like this:

create or replace PROCEDURE get_secuencia(consec OUT NUMBER)
AS
BEGIN
   UPDATE EQUIVALENTES_CONSECUTIVO SET CONSECUTIVO = CONSECUTIVO + 1;   
   SELECT CONSECUTIVO INTO consec FROM EQUIVALENTES_CONSECUTIVO;    
END;
    
answered by 21.08.2018 / 19:05
source