oracle - LOCATE Built in function doesn't work when there are spaces in the search string -


i'm running small problem querying clob field using locate.

i'm searching specific name within clob, add spaces search string returns 0 index.

working code:

select count(reference_#) assigncount aradmin.srmis_request date_occurred_dt not null , (date_occurred_dt >= add_months(sysdate, -12) ) , ({fn locate('info-mgmt-srvcs.r3', "srmis_request"."trace_log")} > 0) 

non-working code:

select count(reference_#) assigncount aradmin.srmis_request date_occurred_dt not null , trim(date_occurred_dt) != '' , (date_occurred_dt >= add_months(sysdate, -12) ) , ({fn locate('the problem has been assigned info-mgmt-srvcs.r3', "srmis_request"."trace_log")} > 0) 

i've queried "srmis_request"."trace_log" , directly copied string spaces clause test.

the oracle docs don't spaces allowed or not.

what's wrong second query?

edit: changed query use instr() insetead of locate() , works.


Comments