Skip site navigation (1) Skip section navigation (2)

Re: JDBC problem with DELETE

From: Cedar Cox <cedarc(at)visionforisrael(dot)com>
To: Dnesbitt(at)encryptix(dot)com
Cc: pgsql-interfaces(at)postgresql(dot)org
Subject: Re: JDBC problem with DELETE
Date: 2000-07-27 07:56:33
Message-ID: (view raw, whole thread or download thread mbox)
Lists: 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

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...)


In response to

pgsql-interfaces by date

Next:From: George P. EsperanzaDate: 2000-07-27 08:35:35
Subject: Changing Default date format
Previous:From: Peter MountDate: 2000-07-27 06:48:07
Subject: RE: JDBC problem with DELETE

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group