Re: variables with SELECT statement

Поиск
Список
Период
Сортировка
От Kevin Duffy
Тема Re: variables with SELECT statement
Дата
Msg-id DFC309C8A42633419600522FA8C4AE1A560F18@mail-01.wrcapital.corp
обсуждение исходный текст
Ответ на variables with SELECT statement  ("Kevin Duffy" <KD@wrinvestments.com>)
Ответы Re: variables with SELECT statement  (Frank Bax <fbax@sympatico.ca>)
Список pgsql-sql
Just testing the regexp_string_to_array

This SQL
select description, regexp_string_to_array(description::text , E'\\s+' )
as optdesc, securitytype     from xxxxxx where type = 'B'   order by 1

produced this error:

ERROR: function regexp_string_to_array(text, text) does not exist
SQL state: 42883
Hint: No function matches the given name and argument types. You may
need to add explicit type casts.
Character: 21


Don't see the difference between the above and the example in the doc's.

kd

-----Original Message-----
From: Osvaldo Kussama [mailto:osvaldo.kussama@gmail.com]
Sent: Friday, September 05, 2008 4:47 PM
To: Kevin Duffy
Subject: Re: [SQL] variables with SELECT statement

2008/9/5, Kevin Duffy <KD@wrinvestments.com>:
> OK that is a syntax I have never seen.  But correct we are getting
> close.
>
> Noticed that string_to_array does not handle double spaces very well.
> If there are double space between the tokens, there is "" (empty
string)
>
> in the array returned.  Not exactly what I expected.
>


Try regexp_split_to_array().
http://www.postgresql.org/docs/current/interactive/functions-matching.ht
ml#FUNCTIONS-POSIX-REGEXP

SELECT regexp_split_to_array('the quick  brown    fox     jumped over
the lazy dog', E'\\s+');            regexp_split_to_array
------------------------------------------------{the,quick,brown,fox,jumped,over,the,lazy,dog}

Osvaldo


В списке pgsql-sql по дате отправления:

Предыдущее
От: Frank Bax
Дата:
Сообщение: Re: variables with SELECT statement
Следующее
От: Frank Bax
Дата:
Сообщение: Re: variables with SELECT statement