In my SP I am trying to get the value from a table and use it for another SQL. The problem is when there is no rows in the table what will the return value be for this SQL
"SELECT max(trans_seq_num) into ltrans_seq_num FROM pv_trans"
I thought it will be null. When I tried this code it does not work becasue the IF condition does not work as it supposed to. It is passing in a null.. Any ideas why?
Thanks
-- begin snippet
SELECT max(trans_seq_num) into ltrans_seq_num FROM pv_trans;
if (ltrans_seq_num = null) Then
ltrans_seq_num := 1;
else
ltrans_seq_num := ltrans_seq_num + 1;
end if;
--end snippet
"SELECT max(trans_seq_num) into ltrans_seq_num FROM pv_trans"
I thought it will be null. When I tried this code it does not work becasue the IF condition does not work as it supposed to. It is passing in a null.. Any ideas why?
Thanks
-- begin snippet
SELECT max(trans_seq_num) into ltrans_seq_num FROM pv_trans;
if (ltrans_seq_num = null) Then
ltrans_seq_num := 1;
else
ltrans_seq_num := ltrans_seq_num + 1;
end if;
--end snippet