I need a solution for string from column values like 'abc xyz-1234' to 'xyz, abc'.
What will be the Oracle SQL query for above solution.
SELECT SUBSTR (COLUMN_NAME,
INSTR (' ', COLUMN_NAME) + 1,
LENGTH (5) - SUBSTR ('%[^a-z,A-Z, ]%', COLUMN_NAME) - 1)
+ ','
+ SUBSTR (COLUMN_NAME, 1, INSTR (' ', COLUMN_NAME) - 1)
FROM table_name;
I'm getting Invalid number error in Oracle SQL.
You can use:
or, using regular expressions (which is less to type but likely to be slower):
Which, for the sample data:
Both output:
fiddle