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
Can I create table without primary key?
What is procedure and function in sql?
How to get list of all tables from a database?
Define join and name different types of joins?
Can dml statements be used in pl/sql?
What is a system versioned table?
explain mysql aggregate functions. : Sql dba
Is primary key a clustered index?
What is primary key and foreign key?
what is a constraint? : Sql dba
How do I send sql query results to excel?
How do I restart sql?
what is data control language? : Sql dba
Difference between table function and pipelined function?
Is not null in sql?