Dbms Constraints 1
Dbms Constraints 1
Table altered.
SQL> commit;
Commit complete.
Table altered.
14 rows selected.
DNAME VARCHAR2(15)
Page 2
sample_constraint
DEPNO NUMBER
MGRSSN CHAR(9)
MGRDATE DATE
*
ERROR at line 1:
ORA-02270: no matching unique or primary key for this column-list
DEPNO
----------
3
3
5
Page 3
sample_constraint
4
5
5
3
1
4
4
10 rows selected.
*
ERROR at line 1:
ORA-02270: no matching unique or primary key for this column-list
DNAME VARCHAR2(15)
DEPNO NUMBER
MGRSSN CHAR(9)
MGRDATE DATE
Page 5
sample_constraint
*
ERROR at line 1:
ORA-02270: no matching unique or primary key for this column-list
Table altered.
Table altered.
SQL> commit;
Commit complete.
DNAME VARCHAR2(15)
DEPNO NOT NULL NUMBER
MGRSSN CHAR(9)
MGRDATE DATE
Table altered.
Page 6
sample_constraint
Table altered.
DEPNO DLOCATION
---------- ---------------
1 Houston
1 Chicago
2 New York
2 San Francisco
3 Salt Lake City
4 Stafford
4 Bellaire
4 Sugarland
5 Houston
9 rows selected.
Table altered.
SQL> commit;
Commit complete.
Page 7
sample_constraint
SQL> select * from tab;
14 rows selected.
PNAME VARCHAR2(15)
PNUMBER NUMBER(5)
PLOCATION VARCHAR2(15)
DEPNO NUMBER(5)
Page 8
sample_constraint
SQL> alter table project modify(pname varchar2(15) constraint
proj_pname NOT NUL
L);
Table altered.
Table altered.
Table altered.
SQL> commit;
Commit complete.
Table created.
Page 9
sample_constraint
1 row created.
1 row created.
1 row created.
1 row created.
1 row created.
1 row created.
1 row created.
1 row created.
1 row created.
Page 10
sample_constraint
1 row created.
1 row created.
1 row created.
Page 11
sample_constraint
12 rows selected.
SQL> commit;
Commit complete.
Table created.
1 row created.
1 row created.
1 row created.
1 row created.
1 row created.
1 row created.
6 rows selected.
SQL> commit;
Commit complete.
Page 13
sample_constraint
Page 14
sample_constraint
SQL> insert into dependent values('453453453',
'John','M','12-Dec-60','Spouse');
1 row created.
4 rows deleted.
1 row updated.
Table altered.
Table altered.
Page 17
sample_constraint
SQL> commit;
Commit complete.
Page 18