From: | will trillich <will(at)serensoft(dot)com> |
---|---|
To: | Pgsql-General <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: single quotes in a select statement |
Date: | 2001-05-11 21:26:39 |
Message-ID: | 20010511162639.C18098@serensoft.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Fri, May 11, 2001 at 11:27:16AM -0400, Joseph wrote:
> Is it possible to have one field
> like the following
>
> 'some text' || case when t='1' then '1' else '2' end
>
> I don't know how to differentiate the different quotes.
double quotes are to "glue together" attributes that would
otherwise seem to be separate tokens:
create table "my table here" (
"some field" varchar(20),
"yet another" serial,
"the last one" float8
);
single quotes delineate string values:
select 'here: '
|| "some field"
|| ' plus also '
|| string("yet another"/"the last one")
from "my table here";
also note that uppercase/lowercase are significant on "quoted"
attributes, but on unquoted ones everything winds up as lowercase:
> create table mytable ("myField" varchar(10));
CREATE
> insert into MYTABLE(myField)values('one');
ERROR: Relation 'mytable' does not have attribute 'myfield'
> insert into MYTABLE("myField")values('one');
INSERT 1063721 1
> Can I use double quotes or some other kind of quotes inside my case
> statement?
parentheses often work wonders. but the only quotes for strings
(that i'm aware of) are 'single quotes'.
to include a single quote inside a string, try
'it''s maybe like this'
'we\'re not always right'
--
don't visit this page. it's bad for you. take my expert word for it.
http://www.salon.com/people/col/pagl/2001/03/21/spring/index1.html
will(at)serensoft(dot)com
http://sourceforge.net/projects/newbiedoc -- we need your brain!
http://www.dontUthink.com/ -- your brain needs us!
From | Date | Subject | |
---|---|---|---|
Next Message | will trillich | 2001-05-11 21:41:19 | Re: Synonym |
Previous Message | will trillich | 2001-05-11 21:18:38 | Re: Postgresql newbie username/password question |