Getting the table name which is using a sequence

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sainiamit25
    New Member
    • Jul 2007
    • 40

    Getting the table name which is using a sequence

    Hi,

    I have the sequence names of all teh sequences which are there in my huge database. Now i want to find out which table is using this sequence name (though it will use it through a package/procedure/trigger). For example if i have a sequence as amit and it is being used in a package as below:-

    insert into cat_table(sno) values(amit.nex tval);

    What i need is the name of the table where it is being used (in this case cat_table). Can you please give me a query to find it out? I tried something on user_source but it didnt work for me.

    Thanks in advance,

    Cheers,
    Amit
  • amitpatel66
    Recognized Expert Top Contributor
    • Mar 2007
    • 2358

    #2
    Originally posted by sainiamit25
    Hi,

    I have the sequence names of all teh sequences which are there in my huge database. Now i want to find out which table is using this sequence name (though it will use it through a package/procedure/trigger). For example if i have a sequence as amit and it is being used in a package as below:-

    insert into cat_table(sno) values(amit.nex tval);

    What i need is the name of the table where it is being used (in this case cat_table). Can you please give me a query to find it out? I tried something on user_source but it didnt work for me.

    Thanks in advance,

    Cheers,
    Amit
    That is not possible to get such information.
    You can ofcourse find out manually from the latest dml statements executed in a session that is using a sequence from v$sql

    Comment

    • v2naveen
      New Member
      • Feb 2008
      • 5

      #3
      Hi

      you try in this data dictionary

      select * from user_sequence where sequence_name = 'SEQ1'
      -- WHERE SEQ1 IN name of seq you specified

      Comment

      Working...