I have to select data from table which has the words both ‘help’ and ‘window’
eg: window.open(’help’) this type of data should be selected.
Both the words are mandatory.
Eg:window.open(’hai’) should not be selected.
This is not working
select * from employee_comment WHERE regexp_like(text,’window*help’) ;
Solution which I gave:
WITH data_Set AS
(
SELECT 1 row_no, ’shdhd dhdh window ddjfdh help’ text_col FROM dual
UNION ALL
SELECT 2 row_no, ’shdhd dhdh help window ddjfdh’ text_col FROM dual
UNION ALL
SELECT 3 row_no, ‘window.open(”hai”) ‘ text_col FROM dual
UNION ALL
SELECT 4 row_no, ‘window.open(”help”)’ text_col FROM dual
)
SELECT row_no FROM data_set
WHERE REGEXP_LIKE(text_col,’.*window.*help.*’)
/
Improved solution after feedback from Volder
WITH data_Set AS
(
SELECT 1 row_no, ’shdhd dhdh window ddjfdh help’ text_col FROM dual
UNION ALL
SELECT 2 row_no, ’shdhd dhdh help window ddjfdh’ text_col FROM dual
UNION ALL
SELECT 3 row_no, ‘window.open(”hai”) ‘ text_col FROM dual
UNION ALL
SELECT 4 row_no, ‘window.open(”help”)’ text_col FROM dual
)
SELECT row_no FROM data_set
WHERE REGEXP_LIKE(text_col,’.*window.*help.*|.*help.*window.*’)
/
0 responses so far ↓
There are no comments yet...Kick things off by filling out the form below.
Leave a Comment