Can we use more than one null value for unique key?
Answer Posted / sabariesh thavamani
i worked out the coding in the above using oracle 9 i, but
i could not get the correct answer what he told.. try it
SQL> create table sab(name varchar2(10) unique);
Table created.
SQL> insert into sab values('&sab');
Enter value for sab: null
old 1: insert into sab values('&sab')
new 1: insert into sab values('null')
1 row created.
SQL> /
Enter value for sab: null
old 1: insert into sab values('&sab')
new 1: insert into sab values('null')
insert into sab values('null')
*
ERROR at line 1:
ORA-00001: unique constraint (LPUSER18.SYS_C0038068)
violated
SQL> /
Enter value for sab: sabari
old 1: insert into sab values('&sab')
new 1: insert into sab values('sabari')
1 row created.
SQL> /
Enter value for sab: null
old 1: insert into sab values('&sab')
new 1: insert into sab values('null')
insert into sab values('null')
*
ERROR at line 1:
ORA-00001: unique constraint (LPUSER18.SYS_C0038068)
violated
SQL> select * from sab
2 ;
NAME
----------
null
sabari
try it....
Is This Answer Correct ? | 5 Yes | 5 No |
Post New Answer View All Answers
What is primary key and foreign key?
What is a sql trace file?
Is a view faster than a stored procedure?
How many sql commands are there?
How to use transactions efficiently : transact sql
What is group function in sql?
Why join is faster than subquery?
what is self join and what is the requirement of self join? : Sql dba
Which is the correct statement about truncate and delete?
how to use 'mysql' to run sql statements? : Sql dba
what is isam? : Sql dba
what happens when the column is set to auto increment and you reach the maximum value for that table? : Sql dba
explain the difference between delete , truncate and drop commands? : Sql dba
Can primary key be changed?
Is it possible to remove child records without removing master table records...the two having pk,fk relationship?