Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Concatenated Primary Key
In the book "Building Intelligent Databases with Oracle PL/SQL
Triggers and Procedures" the author on page 59 says the
individual columns of a concatenated primary key can be null as long
as at least one of the columns is not null.
I have found that when a concatenated primary key is created Oracle
automatically assigns "not null" to each column.
When I do the following I get..
SQL> CREATE TABLE JUNK(X VARCHAR2(10),Y VARCHAR2(10)); Table created.
SQL> ALTER TABLE JUNK ADD CONSTRAINT PK_JUNK PRIMARY KEY (X,Y); Table altered.
SQL> DESC JUNK
Name Null? Type ------------------------------- -------- ---- X NOT NULL VARCHAR2(10) Y NOT NULL VARCHAR2(10)
SQL> INSERT INTO JUNK VALUES('1','A'); 1 row created.
SQL> INSERT INTO JUNK VALUES('1',NULL);
INSERT INTO JUNK VALUES('1',NULL)
*
ERROR at line 1:
ORA-01400: mandatory (NOT NULL) column is missing or NULL during insert
I would like to have some of these columns null. How do I remove the "NOT NULL" constraint so this works like the book says...
-MarkReceived on Mon Jul 27 1998 - 09:01:56 CDT