I need a little help with some sql. I have a table within my oracle db with the following columns
The name column is not being populated to read the surname and then the Firstname ie it's reading Paul Smith instead of Smith Paul. I need an update sql that will populate the Name Column so the surname is in first followed by a , then the firstname.
Check this example and, if necessary, change it to suit your needs.
SQL> WITH TEST AS
2 (SELECT 'Paul Smith' name FROM dual
4 SELECT 'Little Foot' FROM dual
6 SELECT SUBSTR(name, 1, INSTR(name, ' ')) first_name,
7 SUBSTR(name, INSTR(name, ' ') + 1, LENGTH(name)) surname
8 FROM TEST;
I am not trying to be mean, but if you are not capable of writting such a simple update statement and you do not have anyone else that you can ask at your place of employment, could you tell us what your company is so that I can drop any stock that I might have in it! That being said,
set name = surname||', '||firstname;
You do not need a parachute to skydive. You only need a parachute to skydive twice.