I try to extract data in the database and insert it into a record and then show it in cmd, However when I get a larger number of registration 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:
Error Reporting - ORA-01422: Exact Extraction Returns More Than requested number of lines ORA-06512: on 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