I have a table in which I need both values to be primary, because I refer to this combination as a foreign key in other tables. The definition of the table and the data I need to supply are as follows.
create table T1 ( sno number(10), desc varchar2(10), constraint T1_PK primary key(sno,desc) ) DATA to put sno | desc
The problem here desc can sometimes be zero. The primary key cannot be null, so when I encounter a null value, I just insert into the table. The problem here is in some cases desc may have an empty string. If I insert the data 100, Null and 100, “these are two different things, but I can’t put them in the table. I don’t want to put some row like“ EMPTY ”if null, because it can confuse the end user who is watching to the table.
1) How can I handle the null register for desc, having it as a primary key. I can not use automatic sequence number. 2) How can I distinguish between an empty string entered by me and one that already exists?
source share