We have a customer who does {something}, and after that some of our sequences are returning numbers that have already been used. While the long term answer would be for them to stop doing {something}, I need a simple way to check the sequences against the tables they are used in.
I can query user_sequences to get the last_number for each sequence and I can get the max(id_number) for each table. But when I try to do both in the same query I get nulls back.
My broken SQL is:
select max(last_number) , max(id_number) from user_sequences,
squiggly.ACCOUNT_CODE_DEFINITION where sequence_name = 'ACCOUNT_CODE_DEFINITION_SEQ'
and sequence_owner = 'SQUIGGLY' ;
you can get the MAX from both tables with this query: