Re: substr_count

Поиск
Список
Период
Сортировка
От Michael Pohl
Тема Re: substr_count
Дата
Msg-id Pine.LNX.4.44.0307100843370.13741-100000@server1.techplant.com
обсуждение исходный текст
Ответ на substr_count  (Tom Rochester <tomr@chu.com.au>)
Список pgsql-sql
On Thu, 10 Jul 2003, Tom Rochester wrote:

> I would like to achive something along the lines of:
> 
> SELECT field FROM table WHERE field ILIKE '$searchterm' ORDER BY
> substr_count(field, '$searchterm');

If you have plperl installed:

create or replace function substr_count(  varchar(255),  varchar(255)
)
returns int as '  my ($field, $searchterm) = @_;  my $count = $field =~ s/$searchterm//g;  return $count;
' language 'plperl';

michael



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

Предыдущее
От: Rod Taylor
Дата:
Сообщение: Re: Recursive request ...
Следующее
От: Michael A Nachbaur
Дата:
Сообщение: Re: help yourself by helping others