Convert varchar value to upper case and then use like operator : Like « Select Query « Oracle PL / SQL






Convert varchar value to upper case and then use like operator

    
SQL>
SQL> CREATE TABLE product (
  2       product_name     VARCHAR2(25),
  3       product_price    NUMBER(4,2),
  4       quantity_on_hand NUMBER(5,0),
  5       last_stock_date  DATE);

Table created.

SQL>
SQL> INSERT INTO product VALUES ('Small Widget', 99, 1, '15-JAN-03');

1 row created.

SQL> INSERT INTO product VALUES ('Medium Widget', 75, 1000, '15-JAN-02');

1 row created.

SQL> INSERT INTO product VALUES ('Product Number', 50, 100, '15-JAN-03');

1 row created.

SQL> INSERT INTO product VALUES ('Round Church Station', 25, 10000, null);

1 row created.

SQL>
SQL>
SQL> SELECT * FROM product
  2  WHERE  UPPER(product_name) LIKE '%PHOOBAR%';

PRODUCT_NAME              PRODUCT_PRICE QUANTITY_ON_HAND LAST_STOC
------------------------- ------------- ---------------- ---------
Product Number                       50              100 15-JAN-03

SQL>
SQL>
SQL>
SQL> DROP TABLE product;

Table dropped.

   
    
    
  








Related examples in the same category

1.A function using the LIKE operator to return a phone number's area code
2.Like with '__' (Any two characters)
3.Like with '_' and '%'
4.Use two '%' in Like statement
5.Using a NOT operator with like
6.Is Like case sensitive
7.Use % in word ending
8.Use two % signs in one like
9.Use two % signs in like
10.Like '%' function with varchar2 type
11.Like with % on both sides
12.Second letter is A
13.Create pattern dynamically and use it in like statement
14.Pattern Matching LIKE '%great%'
15.Using Pattern Matching LIKE '____ %'
16.comments like '%0\%%' escape '\'
17.Escape \
18.Description has 'SQL' substring