How can I convert the following T-SQL Statement to PL/SQL
set @disbursement_no = (select isnull(max(convert(numeric, right(DV_NO, 6))), 0) + 1
from CD_T_DV_HDR where year(DATE_DV) = year(getdate()))
The data type of DV_NO is varchar and Date_Dv is date.
I’m really new to PL/SQL, and I’m having a hard time to convert my SQL statement to PL/SQL. I Hope you can help me.
It’ll be like this:
Substr(dv_no, -6, 6)fetches the rightmost 6 characters.to_numberconverts the string to number.maxfetches maximum number &coalescechecks if the resultant number is null & converts it to zero.