Re: SELECT question - Mailing list pgsql-general

From Richard Huxton
Subject Re: SELECT question
Date
Msg-id 200311041114.14676.dev@archonet.com
Whole thread Raw
In response to SELECT question  (Alex <alex@meerkatsoft.com>)
List 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

pgsql-general by date:

Previous
From: Richard Huxton
Date:
Subject: Re: Obtain boolean value of expression in PLPGSQL
Next
From: Rob Fielding
Date:
Subject: pg7.3.4: pg_atoi: zero-length string