Question

Is there a way to retrieve all the sequences defined in an existing oracle-sql db schema?

Ideally I would like to use something like this:

SELECT * FROM all_sequences WHERE owner = 'me';

which apparently doesn't work.

Was it helpful?

Solution

Try this:

SELECT object_name
  FROM all_objects
 WHERE object_type = 'SEQUENCE' AND owner = '<schema name>'

OTHER TIPS

Yes:

select * from user_sequences;

Your SQL was almost correct too:

select * from all_sequences where sequence_owner = user;

Below query can be triggered in Oracle Developer to check whether sequence present in DB or not :

SELECT count(*) count FROM user_sequences WHERE sequence_name = 'SEQ_NAME';

If 'SEQ_NAME' present in your DB then count will return 1 else 0 .

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top