Tuesday 4 September 2012

report and function togather to be called


Query :-

select eno,ename,edepartment  from employeetest where eno in (Select * from mytempvals);

Function to be called for remove the , between values and insert the values in the table

create or replace function separate5(a varchar2)return number

is

 

begin

--truncate table mytempvals

delete from mytempvals;

for i in 1..9 loop

insert into mytempvals

select substr(a,instr(a,',',1,i)-2,2) from dual;

end loop;

 

commit;

return 1;

end;

Triger to be called from the report to call the above function after getting value of :empno (10,20,40,30)

function AfterPForm return boolean is

    r number;

 --   V_eno    mytempvals.employeename%type;

--    CURSOR emp_cur IS  

  --  SELECT employeename

   -- FROM  mytempvals;

begin

  r:=separate5(:empno);

  --OPEN emp_cur;

  --For i in 1..9 Loop

  --FETCH emp_cur INTO V_eno;

  --END Loop;

 --CLOSE emp_cur;

  return (TRUE);

end;

No comments:

Post a Comment