diff --git a/docs/4-language-usage/9-function-usage/g-9030.md b/docs/4-language-usage/9-function-usage/g-9030.md index c218f227..6057ac23 100644 --- a/docs/4-language-usage/9-function-usage/g-9030.md +++ b/docs/4-language-usage/9-function-usage/g-9030.md @@ -15,12 +15,17 @@ When converting from strings to other datatypes using a conversion function that ``` sql create or replace package body employee_api is - procedure set_dob(in_employee_id in employees.employee_id%type - ,in_dob_str in varchar2) is + procedure set_dob( + in_employee_id in employees.employee_id%type + ,in_dob_str in varchar2 + ) is + co_employee_id constant employees.employee_id%type := in_employee_id; + co_dob_str constant type_up.date_string := in_dob_str; begin update employees - set date_of_birth = to_date(in_dob_str,'YYYY-MM-DD') - where employee_id = in_employee_id; + set date_of_birth = to_date(co_dob_str,'FXYYYY-MM-DD' -- NOSONAR G-1050 must be a literal +) + where employee_id = co_employee_id; end set_dob; end employee_api; / @@ -30,12 +35,19 @@ end employee_api; ``` sql create or replace package body employee_api is - procedure set_dob(in_employee_id in employees.employee_id%type - ,in_dob_str in varchar2) is + procedure set_dob( + in_employee_id in employees.employee_id%type + ,in_dob_str in varchar2 + ) is + co_employee_id constant employees.employee_id%type := in_employee_id; + co_dob_str constant type_up.date_string := in_dob_str; begin update employees - set date_of_birth = to_date(in_dob_str default null on conversion error,'YYYY-MM-DD') - where employee_id = in_employee_id; + set date_of_birth = to_date( + co_dob_str default null on conversion error + ,'FXYYYY-MM-DD' -- NOSONAR G-1050 must be a literal + ) + where employee_id = co_employee_id; end set_dob; end employee_api; /