0

In MS-Access, I can use character ranges/sets in the where clause:

SELECT
 table_name
FROM 
 all_tab_columns
WHERE
 table_name NOT LIKE 'A[0-9]*' 
 AND table_name NOT LIKE 'D[0-9]*' 
 AND table_name NOT LIKE 'S[0-9]*'

The character range/set is the range of numbers between 0-9. All tables that start with A, D or S, followed by a number, are eliminated from the query.

How can I do this in Oracle?

asked Jan 19, 2017 at 20:47
0

1 Answer 1

1

Use regular expressions:

SELECT
 table_name
FROM 
 all_tab_columns
WHERE
 NOT REGEXP_LIKE(table_name,'^(A|D|S)[0-9]')
answered Jan 19, 2017 at 21:34
1
  • 1
    Careful, this is not the same. Your requirement is to exclude tables starting with A or D or S, so this should be ^A[0-9] and so on (where ^ marks the start of the line). It can be combined into a single expression: ^(A|D|S)[0-9]. Commented Jan 19, 2017 at 22:10

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.