Received: from web14902.mail.yahoo.com (web14902.mail.yahoo.com [216.136.225.54]) by postgresql.org (Postfix) with SMTP id 0F866475898 for ; Tue, 19 Mar 2002 05:03:42 -0500 (EST) Message-ID: <20020319100343.28739.qmail@web14902.mail.yahoo.com> Received: from [202.161.138.9] by web14902.mail.yahoo.com via HTTP; Tue, 19 Mar 2002 02:03:43 PST Date: Tue, 19 Mar 2002 02:03:43 -0800 (PST) From: "Kancha ." Subject: Re: create function problem To: Matteo Beccati , pgsql-sql@postgresql.org In-Reply-To: <2780D698C269CB4EB303715BA48B6A103373@sole.CRP> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Archive-Number: 200203/229 X-Sequence-Number: 7108 > 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/