Re: [GENERAL] concatenation of string literals

From: Maarten Boekhold <maartenb(at)dutepp0(dot)et(dot)tudelft(dot)nl>
To: eric(at)gateway(dot)ctlno(dot)com
Cc: pgsql-general(at)postgreSQL(dot)org
Subject: Re: [GENERAL] concatenation of string literals
Date: 1998-07-17 20:14:08
Message-ID: Pine.SUN.3.91.980717221308.9027A-100000@dutepp0.et.tudelft.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> > This works :
> > psql -c "select arcode || phnum from nccbor_member;"
> >
> > But this doesn't
> > psql -c " select arcode || '-' || phnum from nccbor_member;"
> >
> > It's an inconvience because I am doing mail merges in wordperfect
> > using postodbc, and I keep having to do things like put dashes in
> > phone numbers and such in wordperfect, is there another way to concat
> > string
> literals?
> >
> > --
> > Kurt Seel, Systems Engineer
> > Unified Technologies Corp.
> > Phone : 610 964 8200
> > Email : kseel(at)ut{anti-spam]corp(dot)com
> >
> > To send me email, remove the {anti-spam] from the above address.
> >
>
> You will probably need to put parenthases around either the first two or
> the last two strings:
>
> psql -c " select (arcode || '-') || phnum from nccbor_member;"
>
> that should work fine

My guess is you have to cast the '-' to text and that postgresql at the
moment sees '-' as a char:

select arcode || '-'::text || phnum from nccbor_members

Maarten

_____________________________________________________________________________
| TU Delft, The Netherlands, Faculty of Information Technology and Systems |
| Department of Electrical Engineering |
| Computer Architecture and Digital Technique section |
| M(dot)Boekhold(at)et(dot)tudelft(dot)nl |
-----------------------------------------------------------------------------

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Michael 1998-07-18 06:18:06 PERL Interface - upgrade from 6.2.1 to 6.3.2
Previous Message Bruno LEVEQUE 1998-07-17 19:35:56 PQputline