exact fetch returns more than requested number of rows [message #274136] |
Sun, 14 October 2007 08:30  |
preetinagrawal
Messages: 1 Registered: October 2007
|
Junior Member |
|
|
create or replace procedure net_sal_cal(e_id number,fromdate date,todate date,month number,year number)
is
grosssal number(8);
to_hrs varchar2(10);
v_days number(3);
v_count number(3);
v_leaves number(3);
mon_hrs number(4);
begin
select gross into grosssal from gross_sal where e_id=e_id;
select decode(sum(total_hrs),Null,0) into to_hrs from timecard where emp_id=e_id and (date_detail between fromdate and todate);
select days into v_days from workdays where month=month;
select count(leave) into v_count from timecard where emp_id=e_id and (leave between fromdate and todate);
select leaves into v_leaves from employee where e_id=e_id;
if v_count > 0 then
if v_leaves > 0 then
to_hrs:=to_hrs + (v_leaves * 8);
end if;
end if;
mon_hrs:=v_days*8;
if (to_hrs = mon_hrs) then
insert into net_sal values(e_id,200,500,grosssal-700,month,year);
end if;
end;
/
When i am truing to execute this proc. i m getting error as gross sal n all other tables contains only one row of particular emp id.
The error is: exact fetch returns more than requested number of rows
|
|
|
|
|
Re: exact fetch returns more than requested number of rows [message #274160 is a reply to message #274136] |
Sun, 14 October 2007 18:14  |
pablolee
Messages: 2882 Registered: May 2007 Location: Scotland
|
Senior Member |
|
|
your problem lies here, I would imagine as well as littlefoot's spot (and based on this, I'll vouch that you have other problems too.
select gross into grosssal from gross_sal where e_id=e_id;
but as Michel says. Please read (and adhere to) the guidelines before posting
Here too
select leaves into v_leaves from employee where e_id=e_id;
Think up better names for your parameters
[Updated on: Sun, 14 October 2007 18:17] Report message to a moderator
|
|
|