I have a table Employee
with the columns employee_id
as type number
, and employee_name
as type varchar
.
I need a procedure that takes an input string to insert employees into the table. The procedure should read and analyze the string which will include multiple names separated by commas.
Example:
'adam,alex,hales,jordan,jackob'
Each name should be extracted up until the comma and inserted into the employees table. So basically using the input string above I should have the names inserted as in the following result:
employee_id | employee_name
-------------+--------------
1 | adam
2 | alex
3 | hales
4 | jordan
5 | jackob
Any solution is appreciated.
Best Answer
You don't need a procedure, you can do this in a single SQL statement (though you could wrap that statement in a procedure if necessary):
dbfiddle here