Java to Oracle

I was trying to get whether a table in oracle has auto_increment on or not.

One thing I did was searched for the "sequence name" in "all_sequence table " and used that result.

I want to know if any in built function exists to know this meta data information in ORACLE or is there any better way to do that?

Thanks

Sanjeev

[352 byte] By [GSanjeeva] at [2007-11-27 9:33:01]
# 1
If I understand it correctly, this is an Oracle-specific thing, so I wouldn't expect to find JDBC support for it. Instead, I'd try to find the relevant Oracle metadata pseudo-table and issue an SQL select statement on it through JDBC.
OleVVa at 2007-7-12 22:53:04 > top of Java-index,Java Essentials,Java Programming...
# 2

Since Oracle does not support auto-increment, you need to do this thru sequences and triggers. And since the Sequence has it's own name that is indepent of the table name, there is no way short of parsing the triggers for the table to get the sequence name. At least as far as I can recall. I (fortunately) haven't had to work with Oracle for a while now.

~Tim

SomeoneElsea at 2007-7-12 22:53:04 > top of Java-index,Java Essentials,Java Programming...
# 3
> Since Oracle does not support auto-increment, youDoes this mean that the question "whether a table in oracle has auto_increment on or not" can be answered with a plain No?I was familiar with Oracle 7 and 8 back then, but I'm not up to date with 9 and 10.
OleVVa at 2007-7-12 22:53:05 > top of Java-index,Java Essentials,Java Programming...
# 4

Here is example code of what you would need to do in Oracle to create auto numbering as Tim mentioned:

create sequence my_table_s;

CREATE OR REPLACE TRIGGER my_table_autonumber

BEFORE INSERT ON my_table

FOR EACH ROW

BEGIN

IF (:NEW.id$ IS NULL) THEN

SELECT my_table_s.NEXTVAL INTO :NEW.id$ FROM dual;

END IF;

END;

tarmenela at 2007-7-12 22:53:05 > top of Java-index,Java Essentials,Java Programming...
# 5

> > Since Oracle does not support auto-increment, you

>

> Does this mean that the question "whether a table in

> oracle has auto_increment on or not" can be answered

> with a plain No?

>

yes. Unless of course (quite likely) the original question was incorrectly worded.

jwentinga at 2007-7-12 22:53:05 > top of Java-index,Java Essentials,Java Programming...