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>
Re: substr_count Rod Taylor <rbt@rbt.ca>
Re: substr_count Rajesh Kumar Mallah <mallah@trade-india.com>
Re: substr_count "scott.marlowe" <scott.marlowe@ihs.com>
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
Дата:
FAQ