Re: SELECT question

From: Richard Huxton <dev(at)archonet(dot)com>
To: Alex <alex(at)meerkatsoft(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: SELECT question
Date: 2003-11-04 11:14:14
Message-ID: 200311041114.14676.dev@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tuesday 04 November 2003 10:54, Alex wrote:
> Hi,
>
> I have a bit string , 7 bits, every bit representing a day of the week.
> e.g. 1110011.
> Is there and easy way where I can translate/format that string in a query.
> I want to give the string back with a '-' for every 0 and the first char
> of the Day for every '1'.
> example 1100111 = SM--TFS.

You probably want a small function in plpgsql - see the procedural languages
section of the manual for details. You might want to check the cookbook at
http://techdocs.postgresql.org/ and see if there's similar code you can use
as inspiration.

--
Richard Huxton
Archonet Ltd

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Martin Hart 2003-11-04 11:17:07 Re: Obtain boolean value of expression in PLPGSQL
Previous Message Richard Huxton 2003-11-04 11:12:17 Re: Obtain boolean value of expression in PLPGSQL