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

Can I create table without primary key?

754


What is procedure and function in sql?

765


How to get list of all tables from a database?

876


Define join and name different types of joins?

740


Can dml statements be used in pl/sql?

798


What is a system versioned table?

725


explain mysql aggregate functions. : Sql dba

752


Is primary key a clustered index?

717


What is primary key and foreign key?

747


what is a constraint? : Sql dba

898


How do I send sql query results to excel?

797


How do I restart sql?

744


what is data control language? : Sql dba

767


Difference between table function and pipelined function?

790


Is not null in sql?

748