0
I try to extract data from the database and insert it into a record and then show it in the cmd, But when I get a higher registration number the procedure requires an error message.
Code:
SET SERVEROUTPUT ON
DECLARE
TYPE trec IS RECORD (
cd_multi_empresa NUMBER(8,2),
tp_atendimento CHAR(2)
);
vcAtendimento trec;
cAtendimento VARCHAR2(1000) := 'select cd_multi_empresa,tp_atendimento from cli.atendime FETCH FIRST 2 ROWS ONLY';
BEGIN
Dbms_Output.Put_Line('inicio');
EXECUTE IMMEDIATE cAtendimento INTO vcAtendimento;
Dbms_Output.Put_Line(vcAtendimento.tp_atendimento);
Dbms_Output.Put_Line('fim');
END;
/
Error message:
Bug report - ORA-01422: exact extraction returns more than the requested number of lines ORA-06512: in line 12 01422. 00000 - "Exact fetch Returns more than requested number of Rows" *Cause: The number specified in Exact fetch is Less than the Rows returned. *Action: Rewrite the query or change number of Rows requested start