All,
I have to pass the column name in the where clause in the below sql query.
declare
v_col varchar2(100) := 'deptId';
v_dept varchar2(100);
begin
select 1 into v_dept from department where v_col=100;
dbms_output.put_line(v_dept);
end;
for deptId=100, there is no data in the department table. However, if I execute the query, it output as 1. But, if the same query is replaced as
'select 1 into v_dept from department where deptId=100' the sql throws error 'no data found'. Where am I making the mistake? Please advice.
regards
sen