Hi can you help me to split the name into firstname
, middle name
, lastname
using a pl/sql procedure.
This my procedure:
create or replace procedure proc_name(name in varchar2, a out varchar2, b out varchar2,c out varchar2) is
begin
if regexp_count(name, '/') = 2 then
a := regexp_substr(name, '[^/]+', 1, 1);
b := regexp_substr(name, '[^/]+', 1, 2);
c := regexp_substr(name, '[^/]+', 1, 3);
end if;
end proc_name;
Here is what it should do. Input: sharmi/devi/elango
The output is:
firstname:sharmi
middle name: devi
lastname : elango
I got output for above test cases.
Suppose my input is: /devi/
Then my output should be:
firstname: null
middle name: devi
lastname: null
How shouldcould I make it work?