I have a PL/SQL codes which will get a number of records as parameter to a function.
My codes look like below
for k in (select * from emp where emp_no=t_emp_no ) loop
But there is a requirement which I need to have an extra condition which needs to link to other table to get the accurate emp_no based on certain condition.
If t_type ='CLASSIC' then
sql1 :='select a.emp_no,a.emp_add from a.emp, b.salary where a.emp_no=b.emp_no and salary < 1500';
sql1:='select * from emp where emp_no=t_emp_no';
However, when I pass this sql1 in to for loop like below
for k in (sql1) loop
It has error. I would like to know how can I overcome this issue.