Advertisement

03.03.2008 at 10:13PM PST, ID: 23211813
[x]
Attachment Details

need to create some sql server DDL queries Oracle database compatible

Asked by huzefaq in Oracle 10.x, Databases Miscellaneous, Oracle Database

I am migrating tables from sql server to oracle. Need help in converting SQl server DDL queries Oracle compatible. Any help will be graetly appreciatedStart Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
CREATE TABLE ARTIST(
	ArtistID 		Int 		NOT NULL IDENTITY (1,1),
	Name 			Char(25) 	NOT NULL,
	Nationality 		Char(30) 	NULL,
	Birthdate 		Numeric (4,0) 	NULL,
	DeceasedDate 		Numeric (4,0)	NULL,
 
	CONSTRAINT 	ArtistPK 	PRIMARY KEY (ArtistID),
	CONSTRAINT 	ArtistAK1 	UNIQUE (Name),
 
	CONSTRAINT 	NationalityValues 	CHECK
				(Nationality IN ('Canadian', 'English', 'French', 'German',
				'Mexican', 'Russian', 'Spanish', 'US')),
	CONSTRAINT 	BirthValuesCheck 	CHECK
				(Birthdate < DeceasedDate),
	CONSTRAINT 	ValidBirthYear 		CHECK
				(Birthdate LIKE '[1-2][0-9][0-9][0-9]'),
	CONSTRAINT 	ValidDeathYear 		CHECK
				(DeceasedDate LIKE '[1-2][0-9][0-9][0-9]')
	);
 
CREATE TABLE WORK(
	WorkID 			Int 		NOT NULL IDENTITY (500,1),
	Title 			Char(25) 	NOT NULL,
	Description 		Varchar(1000) 	NULL DEFAULT 'Unknown provenance',
	Copy 			Char(8) 	NOT NULL,
	ArtistID 		Int 		NOT NULL,
 
	CONSTRAINT 	WorkPK 		PRIMARY KEY (WorkID),
	CONSTRAINT 	WorkAK1 	UNIQUE (Title, Copy),
 
	CONSTRAINT 	ArtistFK
			FOREIGN KEY(ArtistID) REFERENCES ARTIST (ArtistID)
				ON DELETE NO ACTION
				ON UPDATE NO ACTION
	);
 
 
CREATE TABLE CUSTOMER(
	CustomerID 		Int 		NOT NULL IDENTITY (1000,1),
	Name 			Char(25) 	NOT NULL,
	Street 			Char(30) 	NULL,
	City			Char(35) 	NULL,
	State			Char(2) 	NULL,
	ZipPostalCode 		Char(9) 	NULL,
	Country 		Char(50) 	NULL,
	AreaCode 		Char(3) 	NULL,
	PhoneNumber 		Char(8) 	NULL,
	Email 			Char(100) 	NULL,
 
	CONSTRAINT 	CustomerPK 	PRIMARY KEY (CustomerID),
	CONSTRAINT 	CustomerAK1 	UNIQUE (Name)
	);
 
 
CREATE TABLE TRANS(
	TransactionID 		Int 		NOT NULL IDENTITY (100,10),
	DateAcquired 		DateTime	NOT NULL,
	AcquisitionPrice 	Numeric (8,2) 	NULL,
	PurchaseDate 		DateTime	NULL,
	SalesPrice 		Numeric (8,2) 	NULL,
	AskingPrice 		Numeric (8,2) 	NULL,
	CustomerID 		Int 		NULL,
	WorkID 			Int 		NOT NULL,
 
	CONSTRAINT 	TransactionPK 	PRIMARY KEY (TransactionID),
 
	CONSTRAINT 	TransactionWorkFK
			FOREIGN KEY(WorkID) REFERENCES WORK (WorkID)
				ON DELETE NO ACTION
				ON UPDATE NO ACTION,
 
	CONSTRAINT 	TransactionCustomerFK 
			FOREIGN KEY(CustomerID) REFERENCES CUSTOMER (CustomerID)
				ON UPDATE NO ACTION
				ON DELETE NO ACTION,
 
	CONSTRAINT 	SalesPriceRange 	CHECK
				((SalesPrice > 1000) AND (SalesPrice <=200000)),
	CONSTRAINT 	ValidTransDate 		CHECK
				(DateAcquired <= PurchaseDate)
	);
 
 
CREATE TABLE CUSTOMER_ARTIST_INT(
	ArtistID 		Int 		NOT NULL,
	CustomerID 		Int 		NOT NULL,
 
	CONSTRAINT 	CustomerArtistPK PRIMARY KEY (ArtistID, CustomerID),
 
	CONSTRAINT 	Customer_Artist_Int_ArtistFK
			FOREIGN KEY (ArtistID) REFERENCES ARTIST (ArtistID)
				ON UPDATE NO ACTION
				ON DELETE CASCADE,
	CONSTRAINT 	Customer_Artist_Int_CustomerFK
			FOREIGN KEY (CustomerID) REFERENCES CUSTOMER (CustomerID)
				ON UPDATE CASCADE
				ON DELETE CASCADE
	);
 
Loading Advertisement...
 
[+][-]03.03.2008 at 10:47PM PST, ID: 21038807

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Oracle 10.x, Databases Miscellaneous, Oracle Database
Sign Up Now!
Solution Provided By: sujith80
Participating Experts: 2
Solution Grade: A
 
 
[+][-]03.03.2008 at 10:59PM PST, ID: 21038842

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.04.2008 at 01:50PM PST, ID: 21045477

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.04.2008 at 01:52PM PST, ID: 21045491

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628