Toad World® Forums

Creating a procedure but not getting executed using toad


#1

hello everyone i am using toad for creating a procedure… i am trying to create a procedure but it is not getting executed…

the procedure is getting created but error is coming in the execution time…

create or replace procedure utv.sampl_procedure
is
startdate DATE;
begin
select tick_date into startdate from utv.tick where tick_date= to_date(‘2017/05/16 09:00:09’ , ‘yyyy/mm/dd hh24:mi:ss’);
dbms_output.put_line(startdate);
end;

exec utv.sampl_proc

this is the error:

ORA-01422: exact fetch returns more than requested number of rows
ORA-06512: at “UTV.SAMPL_PROC”, line 5
ORA-06512: at line 1


#2

You are not able to fetch 2 or more rows into a single variable. So you need to transform your variable “startdate” either to a collection as described here https://docs.oracle.com/cd/B28359_01/appdev.111/b28370/collections.htm or make your where condition more selectable, so it returns only 1 row.