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


Please Help Members By Posting Answers For Below Questions

What is primary key and foreign key?

761


What is a sql trace file?

775


Is a view faster than a stored procedure?

749


How many sql commands are there?

900


How to use transactions efficiently : transact sql

819


What is group function in sql?

798


Why join is faster than subquery?

836


what is self join and what is the requirement of self join? : Sql dba

892


Which is the correct statement about truncate and delete?

804


how to use 'mysql' to run sql statements? : Sql dba

785


what is isam? : Sql dba

799


what happens when the column is set to auto increment and you reach the maximum value for that table? : Sql dba

805


explain the difference between delete , truncate and drop commands? : Sql dba

790


Can primary key be changed?

697


Is it possible to remove child records without removing master table records...the two having pk,fk relationship?

1039