Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Help

Re: Help

From: Daniel Morgan <damorgan_at_exesolutions.com>
Date: Sun, 04 Aug 2002 00:22:28 +0100
Message-ID: <3D4C65B4.E94DC691@exesolutions.com>


Haoyu Zhou wrote:

> I have a simple question:
>
> If in a table definition, certian fields are defined not to be null.
>
> How do I check whether there is such a constraint using sql?
>
> For instance, suppose there is a table say
> create table A (a integer constraint aa primary key,
> b integer constraint bb not null);
>
> Later I will write code to insert (4, -). In order to avoid exception in
> Java, and suppose I don't know constraint bb, I need to check the table A
> whether there is a constraint for b. How can I do that?
>
> Thx in advance.
>
> Haoyu

SELECT constraint_name
FROM all_constraints
WHERE constraint_type = 'C'

This will give you all check constraints. Likely most of them will be NOT NULLs but not all so be careful.

Also look at all_cons_columns.

Daniel Morgan Received on Sat Aug 03 2002 - 18:22:28 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US