Useful shortcuts for vi editor

Sunday 18 September 2016

Oracle escape character examples

First, we need an example data for study.
SQL> insert into departments values ('280','Ad_New',200,1700);

e.g.
SQL> select * from departments where department_name like 'A%';
DEPARTMENT_ID  DEPARTMENT_NAME  MANAGER_ID  LOCATION_ID
10             Administration   200         1700
110            Accounting       205         1700
280            Ad_New           200         1700

SQL> select * from departments where department_name like 'Ad_%';
10             Administration   200         1700
280            Ad_New           200         1700

SQL> select * from departments where department_name like 'Ad/_%' escape '/';
280            Ad_New           200         1700

SQL> select * from departments where department_name like 'Ad__%' escape '_';
280            Ad_New           200         1700