Oracle RDBMS versin : 19c
Question from a newbie :)
In the below example, to find values which do not match 'J%'
AND 'K%'
AND 'P%'
, I had to write a NOT LIKE '%'
condition for each pattern.
In Oracle's SQL, can this be shortened ?
In the Linux world, to grep (GNU grep) for multiple patterns, I can do something like below
grep -E 'John|Pattern2|Pattern3' myFile.txt
I was wondering if there is something similair in SQL world :)
create table test465
(empname varchar2(33),
job_tile varchar2(35)
);
insert into test465 values ('JOHN', 'ACCOUNTANT');
insert into test465 values ('KATE', 'PROGRAMMER');
insert into test465 values ('KEITH', 'SYSTEM ADMIN');
insert into test465 values ('PABLO', 'HR ADMIN');
insert into test465 values ('BELINDA', 'MANAGER');
insert into test465 values ('PETER', 'DIRECTOR');
SELECT *
FROM test465
WHERE empname NOT LIKE 'J%'
AND empname NOT LIKE 'K%'
AND empname NOT LIKE 'P%';
EMPNAME JOB_TILE
--------------------------------- -------------------
BELINDA MANAGER