Error creating procedure in SQL

3

I am creating a simple procedure, in SQL, simply its operation is based on returning the data of those incidents that are in situation = 2 and have not reached the situation = 3, together with the name of the reporting user and the type of user.

The problem is that when compiling I miss this warning: Error (4,3): PLS-00428: an INTO clause is expected in this SELECT statement How can I change my code to be correct?

create or replace
PROCEDURE incidenciasDatos2 IS
BEGIN
  SELECT i.id_reportador, i.id_tipo, s.* FROM incidencia i, situacion s 
  WHERE i.id_incidencia = s.id_incidencia AND s.id_estado = 2 AND s.id_estado <> 3;
END;
    
asked by DDN 04.12.2016 в 12:18
source

1 answer

0

Good, you need to enter the result in a variable, here you need to use the clause INTO .

I modified the query to fit you well and I give you a reference so you can understand it link :

    create or replace PROCEDURE incidenciasDatos2 IS
     BEGIN
variable varchar(200);--lo que sea

     SELECT i.id_reportador, i.id_tipo, s.* INTO variable
    FROM incidencia i, situacion s    
    WHERE i.id_incidencia = s.id_incidencia AND s.id_estado = 2 AND s.id_estado <> 3; 
    END;

answered by 04.12.2016 / 14:17
source