sending a block through jdbc - Mailing list pgsql-jdbc

From Maxime Lévesque
Subject sending a block through jdbc
Date
Msg-id 741db998-8a4f-4442-930f-46821ff785d2@b18g2000yqb.googlegroups.com
Whole thread Raw
Responses Re: sending a block through jdbc  (Kris Jurka <books@ejurka.com>)
Re: sending a block through jdbc  (Craig Ringer <craig@postnewspapers.com.au>)
List 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 ?

pgsql-jdbc by date:

Previous
From: Kris Jurka
Date:
Subject: Re: Unified setBlobs / setBinaryStream question
Next
From: Kris Jurka
Date:
Subject: Re: sending a block through jdbc