IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

adding constraint after creating the table(altering a table)


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
jajularamesh

New User


Joined: 21 Nov 2005
Posts: 8

PostPosted: Thu Dec 29, 2005 12:41 pm
Reply with quote

ALTER TABLE EMPLOYEE ADD CONSTRAINT CON_DEPT
FOREIGN KEY (DEPTNO) REFERENCES DEPT(DEPTNO);

when i am using this i am facing some problem and not able to alter the table .con u figure what wrong with the above command
Back to top
View user's profile Send private message
program developer

New User


Joined: 15 Nov 2005
Posts: 3

PostPosted: Thu Dec 29, 2005 12:54 pm
Reply with quote

whats the error you are getting?
Back to top
View user's profile Send private message
khamarutheen

Active Member


Joined: 23 Aug 2005
Posts: 677
Location: NJ

PostPosted: Thu Dec 29, 2005 2:35 pm
Reply with quote

Hi ramesh,

Quote:
---------+---------+---------+---------+---------+---------+---------+---------+
DSNT404I SQLCODE = 162, WARNING: TABLE SPACE DBTCHN03.TS001 HAS BEEN PLACED IN CHECK PENDING DSNT418I SQLSTATE = 01514 SQLSTATE RETURN CODE DSNT415I SQLERRP = DSNXICRC SQL PROCEDURE DETECTING ERROR
DSNT416I SQLERRD = 20 0 0 -1 0 0 SQL DIAGNOSTIC INFORMATION
DSNT416I SQLERRD = X'00000014' X'00000000' X'00000000' X'FFFFFFFF'
X'00000000' X'00000000' SQL DIAGNOSTIC INFORMATION


U have came across the above error only, it is because

The indicated table space is in the CHECK PENDING state because ALTER TABLE was used to specify a referential constraint on a populated table. The table space is not generally available until the CHECK PENDING state is removed from the table space.

Check for the valid data in that and do again
Back to top
View user's profile Send private message
jajularamesh

New User


Joined: 21 Nov 2005
Posts: 8

PostPosted: Thu Dec 29, 2005 3:00 pm
Reply with quote

ALTER TABLE EMPLOYEE2 ADD CONSTRAINT CON_DEP FOREIGN KEY (DEPTNO) REFERENCES DEPT2(DEPTNO);
------+---------+---------+---------+---------+---------+---------+---------+
T404I SQLCODE = 541, WARNING: THE REFERENTIAL OR UNIQUE CONSTRAINT CON_DEP
HAS BEEN IGNORED BECAUSE IT IS A DUPLICATE
T418I SQLSTATE = 01543 SQLSTATE RETURN CODE
T415I SQLERRP = DSNXICKK SQL PROCEDURE DETECTING ERROR
T416I SQLERRD = 290 0 0 -1 0 0 SQL DIAGNOSTIC INFORMATION
T416I SQLERRD = X'00000122' X'00000000' X'00000000' X'FFFFFFFF'
Back to top
View user's profile Send private message
khamarutheen

Active Member


Joined: 23 Aug 2005
Posts: 677
Location: NJ

PostPosted: Thu Dec 29, 2005 3:03 pm
Reply with quote

Hi ramesh,
It is due to A FOREIGN KEY clause uses the same key and parent table as another FOREIGN KEY clause, or a UNIQUE clause uses the same column list as another UNIQUE clause. In either case, the duplicate clause is ignored. 'name' is either the foreign key name or the name of the first column in the constraint that is ignored.

So if the duplication is an error, correct the statement and execute it again.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Load new table with Old unload - DB2 DB2 6
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Adding QMF and SPUFI to the ISPF menu DB2 20
No new posts Multiple table unload using INZUTILB DB2 2
No new posts Check data with Exception Table DB2 0
Search our Forums:

Back to Top