Hi,
I'm trying to create a cursor within a procedure that have a tablename as parameter. This example is showing what I intend to do:
create or replace procedure test (p1 varchar2) as
cursor c1 (tabname IN varchar2)
is select distinct prod_code from tabname;
c1_rec c1%ROWTYPE;
begin
open c1(p1);
loop
fetch c1 into c1_rec;
dbms_output.put_line(c1_rec.prod_code);
end loop;
close c1;
end;
However, I could not compile the procedure encounter error : PL/SQL: ORA-00942: table or view does not exist
How to overcome this issue ? Thanks in advance.
-------------------------------------
Comgrit
I'm trying to create a cursor within a procedure that have a tablename as parameter. This example is showing what I intend to do:
create or replace procedure test (p1 varchar2) as
cursor c1 (tabname IN varchar2)
is select distinct prod_code from tabname;
c1_rec c1%ROWTYPE;
begin
open c1(p1);
loop
fetch c1 into c1_rec;
dbms_output.put_line(c1_rec.prod_code);
end loop;
close c1;
end;
However, I could not compile the procedure encounter error : PL/SQL: ORA-00942: table or view does not exist
How to overcome this issue ? Thanks in advance.
-------------------------------------
Comgrit