View previous topic :: View next topic
|
Author |
Message |
jajularamesh
New User
Joined: 21 Nov 2005 Posts: 8
|
|
|
|
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 |
|
|
program developer
New User
Joined: 15 Nov 2005 Posts: 3
|
|
|
|
whats the error you are getting? |
|
Back to top |
|
|
khamarutheen
Active Member
Joined: 23 Aug 2005 Posts: 677 Location: NJ
|
|
|
|
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 |
|
|
jajularamesh
New User
Joined: 21 Nov 2005 Posts: 8
|
|
|
|
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 |
|
|
khamarutheen
Active Member
Joined: 23 Aug 2005 Posts: 677 Location: NJ
|
|
|
|
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 |
|
|
|