Toad World® Forums

Creating a procedure but not getting executed using toad


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
startdate DATE;
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’);

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


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 or make your where condition more selectable, so it returns only 1 row.