Reputation: 75
I currently have the following query:
SELECT SPEAKERNAME,
SUBSTR(SPEAKERADDRESS, CHARINDEX('-', SPEAKERADDRESS), 4)
FROM SPEAKER;
I am tyrying to only return the postcode from SPEAKERADDRESS
and the postcode is always after '-' but i am getting an invalid identifier (ORA-00904) error for CHARINDEX
Upvotes: 0
Views: 3945
Reputation: 3106
You can use SUBSTR
and INSTR
:
SELECT SPEAKERNAME,
SUBSTR(SPEAKERADDRESS, instr(SPEAKERADDRESS, '-')+1 ,4)
FROM SPEAKER;
Check Demo.
Upvotes: 1