Mayank Khurrana Mayank Khurrana - 3 months ago 8
SQL Question

How to locate a index in a column value

How to locate a index in a column value

For example:

Database : Oracle

INSTR('-',AEND_NATIVE_EMS_NAME)


I need to find the index of first occurrence of
-
in column
AEND_NATIVE_EMS_NAME


For MySql DB I was using

LOCATE('-', l.AEND_NATIVE_EMS_NAME)


which is working fine for me.

Please help me out with oracle

Answer

Put the parameters inversely

INSTR(AEND_NATIVE_EMS_NAME, '-')