Howdy,
Within PL/SQL I will have a string value and I need to slice out a portion of that string. The list will be comma delimited BUT will have embedded commas which is where I'm facing my problems.
My requirement is that I will pass a numerical value corresponding to which embedded string I require from my "master string".
A sample of the data I will have is
'F', TO_DATE(' 2007-02-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'), to_date('01-dec-2018','dd-mon-yyyy')
In PLSQL
declare
l_high_value varchar2(4000) := q'!'F', TO_DATE(' 2007-02-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'), to_date('01-dec-2018','dd-mon-yyyy') !' ;
begin
dbms_output.put_line(l_high_value);
end;
/
So this "master string" is comprised of 3 values separated by commas. The problem I am having is that the TO_DATE also has comma values within it and there is no way to know how many commas it will have (hence my sample data).
Within the string above there are 3 values:
Value 1 above = 'F'
Value 2 above = TO_DATE(' 2007-02-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')
Value 3 above = to_date('01-dec-2018','dd-mon-yyyy')
The expectation is that if I pass in a value of 1 to whatever function/routine used I will receive the output of 'F'.
If I pass in the value of 2 I will get TO_DATE(' 2007-02-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')
If I pass in the value 3 I will get to_date('01-dec-2018','dd-mon-yyyy').
Any questions please let me know.
Cheers,