Finding sequences and triggers associated with an Oracle table

后端 未结 3 971
失恋的感觉
失恋的感觉 2021-01-01 22:02

I have used this query to fetch the list of sequences belonging to an Oracle database user:

SELECT * FROM all_sequences x,all_tables B
WHERE x.sequence_owner         


        
3条回答
  •  臣服心动
    2021-01-01 22:25

    I found a solution to this problem to guess the sequence of a particular sequence

    select * from SYS.ALL_SEQUENCES where SEQUENCE_OWNER='OWNER_NAME' and LAST_NUMBER between (select max(FIELD_NAME) from TABLE_NAME) and (select max(FIELD_NAME)+40 from TABLE_NAME);
    

    This query will guess by search the LAST_NUMBER of the sequence value between MAX value of the field using sequence and Max value + 40 (in my case cache value is 20, so I put 40)

提交回复
热议问题