Re: sending a block through jdbc
От | Kris Jurka |
---|---|
Тема | Re: sending a block through jdbc |
Дата | |
Msg-id | alpine.BSO.2.00.1005010959380.24884@leary.csoft.net обсуждение исходный текст |
Ответ на | sending a block through jdbc (Maxime Lévesque <maxime.levesque@gmail.com>) |
Список | pgsql-jdbc |
On Fri, 30 Apr 2010, Maxime L?vesque wrote: > 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 PG sets SQLState in the SQLException since it is standardized and not error code which is vendor specific. > sb.append("begin \n"); > sb.append("alter table " + foreingKeyTable.name + " drop > constraint " + fkName + ";\n"); > sb.append("exception when true then \n"); > sb.append("end;"); > > It seems that this is either unsupported or I have bad syntax.... PG will only support anonymous blocks in the upcoming 9.0 release, and then with a different syntax. http://developer.postgresql.org/pgdocs/postgres/sql-do.html Kris Jurka
В списке pgsql-jdbc по дате отправления: