Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: How to know what sequence a table is using?

Re: How to know what sequence a table is using?

From: cyc73 <yachien.chen_at_gmail.com>
Date: 19 Jan 2007 07:32:13 -0800
Message-ID: <1169220733.477513.37300@s34g2000cwa.googlegroups.com>

On Jan 18, 11:29 am, RogBa..._at_gmail.com wrote:
> cyc73 wrote:
> >...Do you know what cause the number to jump?To find what sequence the table might be using, is would do something
> like:
> SELECT SQL_TEXT FROM V$SQL where SQL_TEXT LIKE '%MYTABLENAME%' and
> SQL_TEXT like '%NEXTVAL%'
>
> That might show you an insert statement into your table and the
> sequence name should preface .NEXTVAL.
>
> As far as your other question, another process might be using the same
> sequence for another table, thus incrementing it seperately. Also, it
> is possible to alter the nextval or increment of the sequence.

I tried your SQL statement without the NEXTVAL part because the Insert statement I got is like this:

INSERT INTO MYTABLE (ID, field2, field3) VALUES (:1, :2, :3);

I think they use variables instead of NEXTVAL, and that's why I could not find the sequence name. However, I do know they tried to make the sequence name similar to table name if possible. Thank you again to show me this, which I can use in other place.

Crystal Received on Fri Jan 19 2007 - 09:32:13 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US