case in where clause
hi,
i have a requirement that i need to fetch data from db based on the where condition
create or replace procedure xxtest(p_flag in number,p_job in varchar2) is
cursor c is select * from scott.emp where 1=1 and case when p_flag=1 then
job=p_job
else
job not in(p_job)
end ;
begin
for i in c loop
dbms_output.put_line(i.empno||i.ename);
end loop;
end;
i am facing the sysntax error and i am not sure is it works or not
my requirement is if p_flag =1 then it has to display the p_job details
i have a requirement that i need to fetch data from db based on the where condition
create or replace procedure xxtest(p_flag in number,p_job in varchar2) is
cursor c is select * from scott.emp where 1=1 and case when p_flag=1 then
job=p_job
else
job not in(p_job)
end ;
begin
for i in c loop
dbms_output.put_line(i.empno||i.ename);
end loop;
end;
i am facing the sysntax error and i am not sure is it works or not
my requirement is if p_flag =1 then it has to display the p_job details
0