Errors in in DDL of tables

sky_lt

Member²
Hi,

There are some promblems in PL/SQL developer DDL's
PL/SQL Developer Version 9.0.4.1644

--MY case:
create table test_metadata (id number, name varchar2(20));
create index test_id_idx on test_metadata(id);
alter table test_metadata add constraint pk_meta_id primary key (id) using index test_id_idx;

--Now I have table with UNIQUE pk constraint and NON-UNIQUE index

--Now lets select table in object browser and press edit and "View SQL" (Seems OK)

-- Create table
create table TEST_METADATA
(
id NUMBER not null,
name VARCHAR2(20)
)
tablespace DATA
pctfree 10
initrans 1
maxtrans 255;
-- Create/Recreate indexes
create index TEST_ID_IDX on TEST_METADATA (ID)
tablespace DATA
pctfree 10
initrans 2
maxtrans 255;
-- Create/Recreate primary, unique and foreign key constraints
alter table TEST_METADATA
add constraint PK_META_ID primary key (ID);


--Now lets select table in object browser and select dbms_metadata => DDL (Seems PL/SQL developer
not correctly uses dbms_metadata package for getting ddl as the folowing block will generate errors:

CREATE TABLE "DR_TRANSMASTER"."TEST_METADATA"
( "ID" NUMBER,
"NAME" VARCHAR2(20),
CONSTRAINT "PK_META_ID" PRIMARY KEY ("ID")
USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS NOCOMPRESS LOGGING
TABLESPACE "DATA_TBS" ENABLE
) SEGMENT CREATION DEFERRED
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
TABLESPACE "TABLES" ;

CREATE INDEX "DR_TRANSMASTER"."TEST_ID_IDX" ON "DR_TRANSMASTER"."TEST_METADATA" ("ID")
PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS NOCOMPRESS LOGGING
TABLESPACE "TABLES" ;

ALTER TABLE "DR_TRANSMASTER"."TEST_METADATA" ADD CONSTRAINT "PK_META_ID" PRIMARY KEY ("ID")
USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS NOCOMPRESS LOGGING
TABLESPACE "TABLES" ENABLE;
Here:
1. I get primary key constraint in create table statement(so it will create UNIQUE index automaticaly which is wrong in my case as i need NON-UNIQUE index)
2. After table creation it will also try to create the same non unique index, and primary key constraint once again.

Thanks

Sky_lt

 
Last edited:
Back
Top