I want to assign value to a variable based on if another variable is null or not. I know there is error in the same code i am giving below, but i tried like this and don't know how i can get it done. although it gives clear picture of what i want to do.
declare
lv_var1 varchar2(500);
lv_var2 varchar2(20);
ld_date date;
begin
lv_var2 := 'sample value';
lv_var1 := case ld_date when not null
then lv_var2
end case;
dbms_output.put_line(lv_var1);
end;
i want to assign the the value of lv_var2
into lv_var1
when ld_date
is not null, else lv_var1
will be null.
The error i am getting is ORA-06550
.
This is probably because of the case statement, but what else can i use in place of it to get the result.
Please help. Thanks ...