AUTO_INCREMENT PK Column for Oracle Table [message #2151] |
Tue, 23 June 2009 10:10 |
ajwid01
Messages: 26 Registered: June 2009 Location: UK
|
Junior Member |
|
|
Hi,
I am trying to get a table's specification to implement an auto-increment field based on a sequence lookup.
As I understand it, the pre-requisites for this to be auto-established during the DB Dictionary Import routines is to:
A) Have the PK specified on a numeric column.
B) Have a sequence available following the naming convention <Table_name>_SEQ.
Both these requirements are met, but the table_name.dict.inc does not appear to specify the column as recognised for auto_increment when exported.
Am I doing something wrong?
Best regards,
- Tony.
|
|
|
Re: AUTO_INCREMENT PK Column for Oracle Table [message #2152 is a reply to message #2151] |
Tue, 23 June 2009 13:58 |
AJM
Messages: 2368 Registered: April 2006 Location: Surrey, UK
|
Senior Member |
|
|
I have tested his feature on my system using the following:
CREATE TABLE test_autoincrement (
id number(10) NOT NULL,
field1 varchar2(40) default NULL,
field2 varchar2(255) default NULL,
PRIMARY KEY (id)
);
CREATE SEQUENCE test_autoincrement_seq;
REVOKE ALL ON test_autoincrement FROM PUBLIC;
GRANT SELECT,INSERT,DELETE,UPDATE ON test_autoincrement TO PUBLIC;
REVOKE ALL ON test_autoincrement_seq FROM PUBLIC;
GRANT SELECT,ALTER ON test_autoincrement_seq TO PUBLIC;
I then imported this new table, imported the columns, after which I examined the ID column and noted that the autoincrement property was set correctly. When I exported the table details the dict.inc file showed 'auto_increment' => 'y' on the key field.
Are you sure that you are following the instructions at http://www.tonymarston.net/php-mysql/oracle.html#auto.increm ent
Tony Marston
http://www.tonymarston.net
http://www.radicore.org
|
|
|
|