pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedInsert query
3+ messages / 3 participants
[nested] [flat]
* Insert query
@ 1998-07-14 12:42 Paulo Trezentos <Paulo.Trezentos@iscte.pt>
1998-07-14 14:23 ` Re: [SQL] Insert query Holger Mitterwald <mittehlg@coi.de>
0 siblings, 1 reply; 3+ messages in thread
From: Paulo Trezentos @ 1998-07-14 12:42 UTC (permalink / raw)
To: pgsql-sql
Dear Mr. Reader
I would like to insert a tuple in a table. The problem is that one of my
fields as a " ' ".
The query is like this :
INSERT INTO mytable VALUES ('field1','fiel ' d2');
Is this a bug, or is there another way of inserting that tuple ?
Thanks for reading this
Joao Campanico
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: [SQL] Insert query
1998-07-14 12:42 Insert query Paulo Trezentos <Paulo.Trezentos@iscte.pt>
@ 1998-07-14 14:23 ` Holger Mitterwald <mittehlg@coi.de>
0 siblings, 0 replies; 3+ messages in thread
From: Holger Mitterwald @ 1998-07-14 14:23 UTC (permalink / raw)
To: Paulo Trezentos <Paulo.Trezentos@iscte.pt>; +Cc: pgsql-sql
On Tue, 14 Jul 1998, Paulo Trezentos wrote:
> Dear Mr. Reader
>
> I would like to insert a tuple in a table. The problem is that one of my
> fields as a " ' ".
>
> The query is like this :
>
> INSERT INTO mytable VALUES ('field1','fiel ' d2');
>
> Is this a bug, or is there another way of inserting that tuple ?
psql for example expects a 6th "'" as end for the string. And it is
completely confused by the result :-)
To insert your obscure tuple, you have to 'escape' the "'".
Just try:
INSERT INTO mytable VALUES ('field1','fiel \' d2');
^^
the "'" is not interpreted as part of the sql-command but interpreted as
part of the string.
So long,
Holger
^ permalink raw reply [nested|flat] 3+ messages in thread
* INSERT query !!
@ 1999-02-17 21:02 Atika <agoswa@essex.ac.uk>
0 siblings, 0 replies; 3+ messages in thread
From: Atika @ 1999-02-17 21:02 UTC (permalink / raw)
To: pgsql-sql
HI!!
I am hoping someone can help me with a problem I have.
I am trying to insert values in my pgsql database through a Java
application.
The problem is that I need to insert a String into a table. But, as I am
not going to know the value of this String before hand I can't really put
a value within two single qoutes.
I am basically trying to do something like this:
String input = "This is a String";
myConn.updateQuery("insert into myDB values(input)");
but get an error when I run it saying:
ERROR: attribute input not found
java.sql.SQLException: ERROR: attribute input not found
I am also going to have to insert intger and other such vlaues but am not
going to know their values in the insert statement.
many thanks for your time and help.
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~1999-02-17 21:02 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1998-07-14 12:42 Insert query Paulo Trezentos <Paulo.Trezentos@iscte.pt>
1998-07-14 14:23 ` Holger Mitterwald <mittehlg@coi.de>
1999-02-17 21:02 INSERT query !! Atika <agoswa@essex.ac.uk>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox