Re: Finding Violated Constraint Name in Pro*C
From: N Prabhakar <prabhs_at_po.pacific.net.sg>
Date: 1996/12/04
Message-ID: <584rhv$8im_at_newton.pacific.net.sg>#1/1
Date: 1996/12/04
Message-ID: <584rhv$8im_at_newton.pacific.net.sg>#1/1
Dave Bornstein <davidb_at_dma.isg.mot.com> wrote:
>When Inserting into a table using pro*c, if a constraint is violated,
>is there any way to get the violatd constraint name along with the error
>code. I have looked at the sqlca but I cant find where this information
>is.
>Any help would be appreciated
>
>Thanks,
>
>Dave
Hi there,
Try the following.
if (sqlca.sqlcode < 0)
{
printf("\n Error : %s",sqlca.sqlerrm.sqlerrmc);
}
The above will give you the error message. You need to find out the constraint name (normally it will be SYS_C00 ).If you have given a specific name, then you need to substr the message.
Hope the above helps
Regards
N.Prabhakar Received on Wed Dec 04 1996 - 00:00:00 CET