Oracle- common errors

1, see example below

create or replace procedure p_qr_stu_cid(s_id in number, c_id out number) 
as
begin
  select t.class_id into c_id from student t where t.s_id = s_id;
end;

   Above stored procedure, we can compile, relatively simple, looking no problem, the same s_id into the reference database of student s_id table, the other nothing special, we debugging:

01422-ORA : Returns the number of lines exceeds the actual number of rows requested 
ORA- 06512: In "SCOTT.P_QR_STU_CID", Line. 4 
ORA- 06512:. 7 in the Line 

View Program Sources of error Stack?

   Tip error message does not match the expected return of a single line, check the database: The result is indeed only a return ah. But really, the problem lies in the question to the Senate s_id field with the same name as the table.

    We made some changes to the Senate:

create or replace procedure p_qr_stu_cid(i_s_id in number, c_id out number) 
as
begin
  select t.class_id into c_id from student t where t.s_id = i_s_id;
end;

    Debugger again

 

Guess you like

Origin www.cnblogs.com/ZeroMZ/p/11352241.html