Re: can INFORMIX insert a '"' (double quote) in a char field?
Posted in 1993
->From: bobb@netcom.com (Bob Beaulieu)
->Subject: can INFORMIX insert a '"' (double quote) in a char field?
->Date: Thu, 4 Mar 1993 21:36:39 GMT
->Reply-To: bobb@netcom.com (Bob Beaulieu)
->Organization: Netcom - Online Communication Services (408 241-9760 guest)
->
->Can anyone ADD data to a char field in an INFORMIX database that contains
->quotes? Let's say you have a table (abc) which has 1 field (a) which is
->a char type sizeof 15; can you add the below record?
->
->This is a "test"
->
->------ schema for abc table ----------
->create table abc
->(
->a char(15)
->);
->
->______ script for loading values ----- ____comments____
->
->insert into abc values ("this is a test"); This works
->insert into abc values ("this is a 'test'"); This works
->insert into abc values ("this is a "test""); This doesn't
->insert into abc values ('this is a "test"'); This doesn't
->insert into abc values ("this is a \\"test\\""); This doesn't
->
->As you can see I can get the single quote to work; but, I want the double quote.
->Is this something beyond INFORMIX's capabilities? Can anyone on another
->platform insert a double quote via a script?
->
->Our platform here is
->MIPS RISC 3240 with Informix 4.00.UE1
->
->Thanks for any comments or suggestions.
->
->Bob Beaulieu
->bobb@netcom.com
->--
-> =============================================================
-> Bob Beaulieu bobb@netcom.com
-> San Jose, CA (408) 978-0818
-> =============================================================
->
I have used this approach successfully on both DOS and Sun/Unix platforms:
insert into abc values ("this is a ""test""");
In other words, to put a quote character into a quoted string, use a PAIR
of quote characters. Thus, to put nothing but one double quote into a CHAR
variable:
insert into abc values ("""");
"\\"" works in 4GL, but not in SQL, apparently because of different parsers.
"""" works in both 4GL and SQL.
Regards,
Alan
+------------------------------+---------------------------------------+
| R. Alan Popiel | Internet: alan@den.mmc.com |
| Martin Marietta, LSC | ( Please note: My opinions do not ) |
| P.O. Box 179, M/S 5422 | ( represent official Martin policy. ) |
| Denver, Colorado 80201-0179 | Voice: 303-977-9998 |
+------------------------------+---------------------------------------+