Re: JDBC problem with DELETE

Поиск
Список
Период
Сортировка
От Cedar Cox
Тема Re: JDBC problem with DELETE
Дата
Msg-id Pine.LNX.4.21.0007271031230.10197-100000@nanu.visionforisrael.com
обсуждение исходный текст
Ответ на JDBC problem with DELETE  (Dnesbitt@encryptix.com)
Список pgsql-interfaces
Let me answer this one... ;)

>    stmt.executeUpdate("delete from friend where name='"+someName+"'");
> 
>    SQLException: java.sql.SQLException: ERROR: Attribute 'John Doe' not
> found

Remember that an 'Attribute' is a "field" in PG.  PG is taking this as
WHERE fieldname "name" = fieldname "someName";  PG is somehow receiving
double quotes around 'someName'.  I don't do java, so you figure this one
out..

Change the quoting on someName to single quotes and it should 
work.  Single quotes aroung strings, double quotes around field
names.  Note that double quotes around field or table names are only
required if you need to preserve uppercase letters in the name.(..someone correct me if I'm not right about this...)

-Cedar




В списке pgsql-interfaces по дате отправления:

Предыдущее
От: Peter Mount
Дата:
Сообщение: RE: JDBC problem with DELETE
Следующее
От: "George P. Esperanza"
Дата:
Сообщение: Changing Default date format