Re: create function problem

Поиск
Список
Период
Сортировка
От Kancha .
Тема Re: create function problem
Дата
Msg-id 20020319100343.28739.qmail@web14902.mail.yahoo.com
обсуждение исходный текст
Ответ на Re: create function problem  ("Matteo Beccati" <m.beccati@crpsoftware.it>)
Ответы Re: create function problem  (Jan Wieck <janwieck@yahoo.com>)
Список pgsql-sql
> Hi,
> 
> > create function usage(text)
> > returns numeric
> > as 'select ceil(sum(sessiontime)/60) from
> ath_online
> > where loginname=\'$1\' and  startdate >= (select
> > startdate from cst_package where status=\'t\' and
> > cid=(select cid from cst_customer where
> > loginname=\'$1\'));'
> > language 'sql';
> 
> Try to replace \'$1\' with just $1 (i.e. loginname =
> $1).
> 

the argument is a string so it has to be enclosed in
quotes and \ is to escape the quote. replacing with
just $1 will give error like following:
Unable to identify an operator '=$' for types
'varchar' and 'int4'       You will have to retype this query using an
explicit cast



__________________________________________________
Do You Yahoo!?
Yahoo! Sports - live college hoops coverage
http://sports.yahoo.com/


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

Предыдущее
От: "Matteo Beccati"
Дата:
Сообщение: Re: create function problem
Следующее
От: Kelly Burkhart
Дата:
Сообщение: optimizer tuning/forcing correct index use