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

Explain two easy sql optimizations.

604


what is error ora-03113: end-of-file on communication channel?

607


How to run sql statements through the web interface?

514


Why do we need view in sql?

551


What is flag in sql?

546






Is it possible to read/write files to-and-from PL/SQL?

657


How can you fetch common records from two tables?

594


how to present a past time in hours, minutes and seconds? : Sql dba

568


What are the types of operators available in sql?

554


What are %type and %rowtype for?

619


Enlist the characteristics of pl/sql?

1245


What do you think about pl/sql?

535


How many sql commands are there?

676


discuss about myisam index statistics collection. : Sql dba

531


How would you reference column values before and after you have inserted and deleted triggers?

623