1 Replies - 1273 Views - Last Post: 27 April 2010 - 05:09 PM

#1 Bladescope   User is offline

  • D.I.C Head
  • member icon

Reputation: 3
  • View blog
  • Posts: 71
  • Joined: 01-September 09

[Oracle] Create Table with Constraints

Posted 26 April 2010 - 03:00 PM

Hey D-I-Coders,

I've ran into a problem during revision I can't test out for myself (being at home, I don't have Oracle on my computer).

When creating a table, I have been given the specifications of a column's constraints to be "> 0" and "NOT NULL".

What I want to know is the order I go about writing this - is the order right in the code below, or is there another way to go about it?
This is what I have so far:
Also, this line of code is contained in a CREATE TABLE function.

Cust_house	number		CONSTRAINT house_non_negative CHECK (Cust_house > 0)	NOT NULL,


Apologies the coding if it is completely wrong.

Any time spend helping me on this matter is greatly appreciated,

Bladescope

Is This A Good Question/Topic? 0
  • +

Replies To: [Oracle] Create Table with Constraints

#2 1933   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 27-March 10

Re: [Oracle] Create Table with Constraints

Posted 27 April 2010 - 05:09 PM

If I understand what you are asking, depending on the situation of the attribute, you could just make it an integer. So it could look something like this:
CREATE TABLE table_name
(table_key CHAR(5) NOT NULL PRIMARY KEY,
cust_house INT NOT NULL);


Was This Post Helpful? 0
  • +
  • -

Page 1 of 1