Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: Is there any way we can exclude all possible values ?
This works too:
create table test (
col1 number(4) not null, col2 varchar2(10) check (col2 in (null)));
Andrew W. Kerber
Oracle DBA
UMB
"If at first you dont succeed, dont take up skydiving"
-----Original Message-----
From: oracle-l-bounce_at_freelists.org
[mailto:oracle-l-bounce_at_freelists.org] On Behalf Of Greg Norris
Sent: Friday, December 29, 2006 9:48 AM
To: oracle-l_at_freelists.org
Subject: Re: Is there any way we can exclude all possible values ?
On 12/29/06, xiaoyan <xiaoyezi.xyz_at_163.com> wrote:
> Is there any way we can exclude all possible values to be assigned
to a
> column in a table without knowing the type of the column ?
While I really don't see any point to this, something like the following should work...
SQL> create table test (
2 col1 number(4) not null, 3 col2 varchar2(10) constraint what_the_heck check (0=1)4 );
Table created.
SQL> insert into test values (1, 'test');
insert into test values (1, 'test')
*
ERROR at line 1:
ORA-02290: check constraint (SYSTEM.WHAT_THE_HECK) violated
SQL> insert into test values (1, NULL);
insert into test values (1, NULL)
*
ERROR at line 1:
ORA-02290: check constraint (SYSTEM.WHAT_THE_HECK) violated
-- "I'm too sexy for my code." - Awk Sed Fred. -- http://www.freelists.org/webpage/oracle-l ------------------------------------------------------------------------------ NOTICE: This electronic mail message and any attached files are confidential. The information is exclusively for the use of the individual or entity intended as the recipient. If you are not the intended recipient, any use, copying, printing, reviewing, retention, disclosure, distribution or forwarding of the message or any attached file is not authorized and is strictly prohibited. If you have received this electronic mail message in error, please advise the sender by reply electronic mail immediately and permanently delete the original transmission, any attachments and any copies of this message from your computer system. Thank you. ============================================================================== -- http://www.freelists.org/webpage/oracle-lReceived on Fri Dec 29 2006 - 10:04:38 CST
![]() |
![]() |