where can i call the procedure in the procedure in the package [message #610948] |
Wed, 26 March 2014 05:05 |
|
mist598
Messages: 1195 Registered: February 2013 Location: Hyderabad
|
Senior Member |
|
|
Hi all,
I want to call the procedure in the procedure before the open cursor as below.But i am not getting at the front end program.
So my issue is where can i call the procedure in the procedure.
create or replace package xx_extract
cursor v_cursor
is
select id,number
from tablename;
v_cursor_rec v_cursor%rowtype;
v_in_number,xxc_all.in_number%TYPE;
v_in_date xxc_all.in_date%TYPE;
Begin
procedure xxc_process is
Begin
xxc_get(v_cursor_rec.id,v_cursor_rec.number);
open v_cursor;
loop
fetch v_cursor into v_cursor_rec;
exit when v_cursor%notfound;
end loop;
close v_cursor;
end xxc_process;
procedure xxc_get(in_id tablename.id%type,
in_number tablename.number%type)
is
begin
select in_number,in_date
into v_in_number,v_in_date
from xxc_all
where column1=to_char(in_id)
and column2=to_char(in_number);
EXCEPTION
WHEN NO_DATA_FOUND THEN
in_id := NULL;
in_number := NULL;
end xxc_get;
end;
[Updated on: Wed, 26 March 2014 05:10] Report message to a moderator
|
|
|
|
|
|
|
|
|
|
Re: where can i call the procedure in the procedure in the package [message #610979 is a reply to message #610966] |
Wed, 26 March 2014 07:45 |
|
mist598
Messages: 1195 Registered: February 2013 Location: Hyderabad
|
Senior Member |
|
|
Hi ,
I am not getting any values , i want to display empno,hiredate and i used dbms also, why ? I am NULL Values.
CREATE OR REPLACE PACKAGE body xx_extract
AS
CURSOR v_cursor
IS
SELECT empno, a.deptno,a.hiredate
FROM emp a, dept d
WHERE a.deptno = d.deptno;
v_cursor_rec v_cursor%ROWTYPE;
v_in_number emp.empno%TYPE;
v_in_date emp.hiredate%TYPE;
PROCEDURE xxc_process
IS
BEGIN
OPEN v_cursor;
LOOP
FETCH v_cursor
INTO v_cursor_rec;
EXIT WHEN v_cursor%NOTFOUND;
xxc_get (v_cursor_rec.empno, v_cursor_rec.deptno);
END LOOP;
CLOSE v_cursor;
END xxc_process;
PROCEDURE xxc_get (in_id in emp.empno%TYPE, in_number in emp.deptno%TYPE)
IS
BEGIN
SELECT empno, hiredate
INTO v_in_number, v_in_date
FROM emp
WHERE empno =in_id
AND deptno = in_number;
dbms_output.put_line('Number'||v_in_number||' '||'Date'||v_in_date);
EXCEPTION
WHEN NO_DATA_FOUND
THEN
v_in_number := NULL;
v_in_date := NULL;
END xxc_get;
END xx_extract;
|
|
|
|
|
|