catch SQLException, error code for Foeign key violation,

From: "surabhi(dot)ahuja" <surabhi(dot)ahuja(at)iiitb(dot)ac(dot)in>
To: <pgsql-general(at)postgresql(dot)org>
Subject: catch SQLException, error code for Foeign key violation,
Date: 2006-04-17 12:20:35
Message-ID: 8626C1B7EB748940BCDD7596134632BE398675@jal.iiitb.ac.in
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

i am working with PostgreSQL 8.0.0

and the programming lang used is java

i have a stored procedure which inserts a row in a table

to this stored procedure i pass the values which have to be inserted in that row.

now, i execute this query(which is a call to stored procedure)

this execute query is in a try block

and i catch SQL exception for it.

The question is that is from this SQLException can i detect if it is a foreign key violation,

i saw there is a method on SQLException,
e.getErrorCode, is ther specific error code for Foreign Key violation,

thanks,
regards
Surabhi

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Devrim GUNDUZ 2006-04-17 12:43:34 Question about partitioning
Previous Message surabhi.ahuja 2006-04-17 12:07:16 Re: hard shutdown of system