From: | Henry Drexler <alonup8tb(at)gmail(dot)com> |
---|---|
To: | Gary Chambers <gwchamb(at)gwcmail(dot)com> |
Cc: | pgsql-novice(at)postgresql(dot)org |
Subject: | Re: opposite of chr(int) |
Date: | 2011-10-06 21:19:17 |
Message-ID: | CAAtgU9SBgDC2f7Ba_2ACz8reKFb2M8-X7uxyGV4VmdJ2EYNeZw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
Thank you, I will try that out tonight.
On Thu, Oct 6, 2011 at 4:15 PM, Gary Chambers <gwchamb(at)gwcmail(dot)com> wrote:
> Henry,
>
>
> select
>> case
>> when substring('wallawa9kl',8,1) = '0' then 'true'
>> when substring('wallawa9kl',8,1) = '1' then 'true'
>> when substring('wallawa9kl',8,1) = '2' then 'true'
>> when substring('wallawa9kl',8,1) = '3' then 'true'
>> when substring('wallawa9kl',8,1) = '4' then 'true'
>> when substring('wallawa9kl',8,1) = '5' then 'true'
>> when substring('wallawa9kl',8,1) = '6' then 'true'
>> when substring('wallawa9kl',8,1) = '7' then 'true'
>> when substring('wallawa9kl',8,1) = '8' then 'true'
>> when substring('wallawa9kl',8,1) = '9' then 'true'
>> else 'false'
>> end
>>
>
> just wondering if there is something more compact or if this is an okay
>> workaround solution.
>>
>
> How about:
>
> CREATE OR REPLACE FUNCTION has_digit(text)
> RETURNS boolean
> LANGUAGE sql
> AS $function$
> select case when substring($1, '\d') is not null then true
> else false
> end
> $function$
>
> -- Gary Chambers
>
From | Date | Subject | |
---|---|---|---|
Next Message | Merlin Moncure | 2011-10-06 21:23:29 | Re: opposite of chr(int) |
Previous Message | Henry Drexler | 2011-10-06 21:18:22 | Re: opposite of chr(int) |