Table - Create
CREATE TABLE ar_details 
PCTFREE 10
PCTUSED 40
tablespace DBSTAR_VALIDATE
	STORAGE (	INITIAL  1M
	NEXT  1M
	MINEXTENTS 1
	MAXEXTENTS unlimited
	PCTINCREASE 50
	        )
AS SELECT * FROM ar_details@DBSTARt1
;



PCTFREE 10
PCTUSED 40
INITRANS 1
MAXTRANS 255
-- storage definition
TABLESPACE ts_data
	STORAGE (	INITIAL  13M
	NEXT  10M
	MINEXTENTS 1
	MAXEXTENTS unlimited
	PCTINCREASE 50
	        )
;

CREATE TABLE CNV_TABLE_TYPE tablespace cnv_data
AS SELECT * FROM CNV_TABLE_TYPE@DBSTAR

-- create table as select
create table cnv_table_type 

create table temp_dbstar_client 
as select * from client where rownum < 30 and effective_date is not null
;
commit;

create table DB_PREAUTH_CUST_RECORD_temp
as select * from DB_PREAUTH_CUSTOMER_RECORD;
commit;

create table temp_sequences
as select * from temp_sequences@p1aqcis;
commit;

update DB_PREAUTH_CUSTOMER_RECORD set due_day=null;
commit;
ALTER TABLE DB_PREAUTH_CUSTOMER_RECORD 
MODIFY(DUE_DAY NUMBER(2,0) DEFAULT 0);
update DB_PREAUTH_CUSTOMER_RECORD ap
set due_day=(select due_day
             from   DB_PREAUTH_CUST_RECORD_temp atemp
             where  atemp.ACCOUNT_NUMBER   =  ap.ACCOUNT_NUMBER 
               and  atemp.CUSTOMER_SEQNBR  =  ap.CUSTOMER_SEQNBR);
commit;
drop table  DB_PREAUTH_CUST_RECORD_temp;


-- generic create table statement 
CREATE TABLE table1
(col1 CHAR(8) NOT NULL
,col2 CUSTOMER_SEQNBR NUMBER NOT NULL
,col3 char(8) NOT NULL
,col4 char(1) NOT NULL
,CONSTRAINT table1_C1  CHECK ( col4 IN ('Y', 'N') )
,CONSTRAINT table1_PK  PRIMARY KEY (col1, col2)
	USING INDEX 
	PCTFREE 10
	INITRANS 2
	MAXTRANS 255
	TABLESPACE ts_index
	STORAGE (	INITIAL  512K
	NEXT  2M
	MINEXTENTS 1
	MAXEXTENTS 100
	PCTINCREASE 20
	        )
,CONSTRAINT table1_U1 UNIQUE (col3)
	USING INDEX 
	PCTFREE 10
	INITRANS 2
	MAXTRANS 255
	TABLESPACE ts_index
	STORAGE (	INITIAL  512K
	NEXT  888K
	MINEXTENTS 1
	MAXEXTENTS 100
	PCTINCREASE 20
	        )
,CONSTRAINT EMPLOYEE$BILL FOREIGN KEY (ASKED_FOR_BILL_EMP) REFERENCES ADMIN.DB_EMPLOYEE (EMPLOYEE_ID)
)
PCTFREE 10
PCTUSED 40
INITRANS 1
MAXTRANS 25
TABLESPACE ts_data
	STORAGE (	INITIAL  13M
	NEXT  10M
	MINEXTENTS 1
	MAXEXTENTS 500
	PCTINCREASE 50
	        )
;

-- Another simple example
CREATE TABLE testtable1
(col1 CHAR(8) NOT NULL
,CONSTRAINT table1_PK  PRIMARY KEY (col1)
)
;
CREATE TABLE testtable2
(col1 CHAR(8) NOT NULL
,col2 CHAR(8) NOT NULL
,col3 CHAR(8) NOT NULL
,CONSTRAINT test1 FOREIGN KEY (col1) REFERENCES testtable1(col1)
,CONSTRAINT test2 FOREIGN KEY (col2) REFERENCES testtable1(col1)
,CONSTRAINT test3 FOREIGN KEY (col3) REFERENCES testtable1(col1)
)
;