SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Constraint problem
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

ithrol
Starting Member

1 Posts

Posted - 09/07/2012 :  06:27:11  Show Profile  Reply with Quote
Ok so im running into some issues executing my code.
So creating the table

CREATE TABLE Penalty(
Penalty_Type CHAR(8),
MinDay NUMERIC(3,0) NOT NULL,
MaxDay NUMERIC(3,0) NOT NULL,
"Cost" NUMERIC(3,2) NOT NULL,
CONSTRAINT Penalty_PenaltyType_pk PRIMARY KEY(Penalty_Type),
CONSTRAINT Penalty_PenaltyType_ck CHECK(Penalty_Type LIKE '[P][e][n][a][l][t][y][0-9]')
);

Then inserting the data

INSERT ALL
INTO Insurance VALUES ('N','No Cover',0)
INTO Insurance VALUES ('P', 'Partial Cover', 20.99)
INTO Insurance VALUES ('F', 'Full Cover', 35.5)
SELECT * FROM dual;

Then getting this error message,

SQL Error: ORA-02290: check constraint (SYSTEM.INSURANCE_INSURANCEID_CK) violated
02290. 00000 - "check constraint (%s.%s) violated"
*Cause: The values being inserted do not satisfy the named check

*Action: do not insert values that violate the constraint.

then i remove the constraint and i get this one, i cant seem to win :(

SQL Error: ORA-01438: value larger than specified precision allowed for this column
01438. 00000 - "value larger than specified precision allowed for this column"
*Cause: When inserting or updating records, a numeric value was entered
that exceeded the precision defined for the column.
*Action: Enter a value that complies with the numeric column's precision,
or use the MODIFY option with the ALTER TABLE command to expand
the precision.

any help greatly appreciated :)

Abu-Dina
Posting Yak Master

United Kingdom
199 Posts

Posted - 09/07/2012 :  06:33:48  Show Profile  Reply with Quote
This is a SQL Server forum.

Try posting this in an Oracle forum instead:

http://www.dbforums.com/oracle/
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000