Hi
I am trying to move a table from test to prod.
The table contains a identity column defined as COL_PK NUMBER GENERATED BY DEFAULT AS IDENTITY
When I execute a Schema Compare then the resulting script returns MASTER_APP_FACT_DIM_ID NUMBER GENERATED AS IDENTITY. It is missing BY DEFAULT.
Is this normal behavior? Is it possible to have Toad create the script for the table with the full definition?
Br
An
What version of Toad are you using? I just tried this in the beta and it worked as expected for me.
I created these tables:
create table comp1.comp_test
(col1 number GENERATED by default AS IDENTITY,
col2 number,
col3 date);
create table comp2.comp_test
(col1 number GENERATED always AS IDENTITY,
col2 number,
col3 date);
and then when I ran the schema compare, this was the sync script:
ALTER TABLE COMP2.COMP_TEST
MODIFY(COL1 GENERATED BY DEFAULT AS IDENTITY ( MAXVALUE 9999999999999999999999999999 MINVALUE 1 NOCYCLE CACHE 20 NOORDER NOKEEP));
If your set up was different, please provide details so I can reproduce it.
Thanks.
What version of Toad are you using?
For me, when the target table does not exist, the sync script creates it with this statement:
CREATE TABLE COMP2.COMP_TEST
(
COL1 NUMBER GENERATED BY DEFAULT AS IDENTITY ( START WITH 1 MAXVALUE 9999999999999999999999999999 MINVALUE 1 NOCYCLE CACHE 20 NOORDER NOKEEP),
COL2 NUMBER,
COL3 DATE
)
TABLESPACE USERS
PCTUSED 0
PCTFREE 10
INITRANS 1
MAXTRANS 255
STORAGE (
PCTINCREASE 0
BUFFER_POOL DEFAULT
FLASH_CACHE DEFAULT
CELL_FLASH_CACHE DEFAULT
)
LOGGING
NOCOMPRESS
NO INMEMORY
NOCACHE
RESULT_CACHE (MODE DEFAULT)
NOPARALLEL
MONITORING;
I tried Toad 12.12, against Oracle 12.2, with storage and other options unchecked. I got this result:
CREATE TABLE COMP2.COMP_TEST
(
COL1 NUMBER GENERATED BY DEFAULT AS IDENTITY ( START WITH 1 MAXVALUE 9999999999999999999999999999 MINVALUE 1 NOCYCLE CACHE 20 NOORDER NOKEEP),
COL2 NUMBER,
COL3 DATE
);
Please send me the full DDL for your table. Maybe there is some other factor.
I can reproduce this now.
If you uncheck “sequences” in the object types to compare, it will work.
I will have this fixed soon.
Fixed for next beta and 13.1. Thank you for reporting this and for your patience while I tried to figure it out!
I'm still getting this issue with 26.1.193.8012. I'm comparing a schema between 12c and 19c and columns number (38) generated always as identity. Even just viewing the Script tab for a table shows
ID NUMBER(38) GENERATED BY DEFAULT AS IDENTITY ( START WITH 1 MAXVALUE 9999999999999999999999999999 MINVALUE 1 NOCYCLE CACHE 20 NOORDER NOKEEP) NOT NULL
instead of
ID NUMBER GENERATED BY DEFAULT AS IDENTITY,
Hi Dan,
All of this stuff: ( START WITH 1 MAXVALUE 9999999999999999999999999999 MINVALUE 1 NOCYCLE CACHE 20 NOORDER NOKEEP) is just sequence parameters. It's not a bug.
I tested to make sure GENERATED ALWAYS/BYDEFAULT is coming out correctly in the script tab as well as schema compares and for me it is. If you have found a case where it does not, can you give me some more details like full "create" script of the table in each schema, as well as a screen shot of your schema compare options in these places?
Thanks
-John

It is detecting that the right pane has an additional NOSCALE parameter to the inline sequence, but I'm not sure why the sequence shows at all.
The example table dll:
CREATE TABLE
AAATEXT
(
ACRONYM VARCHAR2(3) DEFAULT 'BBB' NOT NULL,
SEC_ID NUMBER(38) DEFAULT 0 ,
GUID_ID VARCHAR2(40) DEFAULT 'SYS_GUID() ' NOT NULL,
ID NUMBER(38) GENERATED BY DEFAULT AS IDENTITY,
A_ID INTEGER,
B_ID INTEGER,
EXTERNAL_CODE VARCHAR2(100),
EXTERNAL INTEGER DEFAULT 0 NOT NULL,
RATIO NUMBER(6,4) DEFAULT 1.0000 NOT NULL,
STATUS_CODE VARCHAR2(10) DEFAULT 'I' NOT NULL,
A_DATE DATE NOT NULL,
DETAIL VARCHAR2(200),
A_AMOUNT NUMBER(30,12)
);
Sorry about that. That's the default setting for new users on the forum. I forgot about that.
I just increased your privileges on the form. Please try again with your screen shot. Thanks
It shows the sequence because when you create a table with an IDENTITY column, Oracle creates a sequence behind the scenes to implement it. The sequence name is something like ISEQ$$_ followed by 6 digit number.
The SQL that Toad is producing is valid. The sequence parameters that you see come from that sequence.
I just used your script to create that table on a schema in Oracle version 12.2.0.1 and one in 19.3.0.0.0 and schema compare detected no differences when I compared the schemas.