Search code examples
oracle-databasesql-like

LIKE operator is not fetching results in oracle


I want to get the results by applying LIKE operator. But its not giving me the result.

Below is my Query.

Select * from TBL_ZONAL_HEAD_INFO where upper(ZONE_HEAD_NAME) LIKE '%ami%';

The above query is not fetching me any results from the data below

Query in procedure

Select * from TBL_ZONAL_HEAD_INFO where upper(ZONE_HEAD_NAME) LIKE '%' || upper(P_ZONENAME) || '%';

img


Solution

  • You have to match it with UPPER CASE.

    SELECT
        *
    FROM
        TBL_ZONAL_HEAD_INFO
    WHERE
        UPPER(ZONE_HEAD_NAME) LIKE upper('%Ami%'); -- used upper case AMI here
    

    Cheers!!