Procedure does not return the entire column

0

I created a procedure with ibexpert, does commit correctly, but at the time of running procedure , I get the error:

  

multiple rows in singleton select.

My intention is to list all the values in the city column of the target table. When I run select in a normal query , it returns all the values in the column, it just does not do the same in procedure , being same way.

The following is the code below:

create or alter procedure VER_TODOS_DEST  
returns (CIDADES char(20))  
as  
begin  
  select cidade from destino  
  into :cidades;  
  suspend;  
end
    
asked by anonymous 01.12.2017 / 06:56

1 answer

0

Within procedure or trigger the command select can only return 1 record.

To do what you want you need to use for select as below.

create or alter procedure VER_TODOS_DEST
returns (
    CIDADES char(20))
as
begin
  for
      select
          CIDADE
      from
          DESTINO
      into
          :CIDADES
  do
    suspend;
end
    
12.01.2018 / 19:35