sending a block through jdbc

From: Maxime Lévesque <maxime(dot)levesque(at)gmail(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: sending a block through jdbc
Date: 2010-05-01 03:20:20
Message-ID: 741db998-8a4f-4442-930f-46821ff785d2@b18g2000yqb.googlegroups.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

I want to drop a constraint if it exists, and not get an error if it
doesn't exist,
ideally I'd get a jdbc error code, and silence the 'consrtaint does
not exist' exception,
but since postgress doesn't send error codes to jdbc, I'd like to put
the statement in
a block and silence the exception like this

sb.append("begin \n");
sb.append("alter table " + foreingKeyTable.name + " drop
constraint " + fkName + ";\n");
sb.append("exception when true then \n");
sb.append("end;");

statement.execute(sb.toString)

It seems that this is either unsupported or I have bad syntax....

Any clues on ho to do this ?

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Kris Jurka 2010-05-01 14:02:55 Re: sending a block through jdbc
Previous Message Kris Jurka 2010-04-30 22:02:33 Re: Unified setBlobs / setBinaryStream question