Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Help
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
![]() |
![]() |