X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id AF2AFD1B584; Sat, 20 Sep 2003 11:41:11 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 31439-04; Sat, 20 Sep 2003 08:41:03 -0300 (ADT) Received: from davlin.co.in (ns.vasnet.net.in [202.4.160.11]) by svr1.postgresql.org (Postfix) with ESMTP id C3A0DD1B57E; Sat, 20 Sep 2003 08:40:58 -0300 (ADT) Received: from Application (unknown [202.4.160.30]) by davlin.co.in (Postfix) with ESMTP id F1AEF14B78; Sat, 20 Sep 2003 16:46:27 +0530 (IST) Message-ID: <7144314.1064057032072.JavaMail.tomcat@mail.davlin.co.in> From: shyamperi@davlin.co.in To: jeanmichel.chabanne@free.fr Subject: Re: Error with functions Cc: pgsql-admin@postgresql.org Cc: pgsql-sql@postgresql.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_274_664745.1064057031920" Date: Sat, 20 Sep 2003 16:46:28 +0530 (IST) X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200309/328 X-Sequence-Number: 10416 ------=_Part_274_664745.1064057031920 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 5:08p Dear All, When I am executing any function with parameter.. I am unable to access the= m. So, I would be thankful if, anyone can help me in teaching this aspect. CREATE FUNCTION add_one (integer) RETURNS INTEGER AS ' BEGIN RETURN $1 + 1; END; ' LANGUAGE 'plpgsql'; The expected ouput of the above function should be 11 when we pass the 10 t= o it.... but it returns 1. Thank you in advance ----- Warm Regards Sh=FFam Peri II Floor, Punja Building, M.G.Road, Ballalbagh, Mangalore-575003=20 Ph : 91-824-2451001/5 Fax : 91-824-2451050=20 ----------------Original Message------------------ shyamperi@davlin.co.in a =E9crit : >Hey, >create or replace function sample(varchar,int) returns varchar as' >declare > data alias for $1; > size alias for $2; >begin > return substr(data,(length(data)-size)+1,length(data)); >end; >' language 'plpgsql'; >____________________________ >WARNING: plpgsql: ERROR during compile of sample near line 2 >ERROR: parse error at or near ";" > >Can any body tell me why is this error coming >----- >Warm Regards >Sh=FFam Peri > >II Floor, Punja Building, >M.G.Road, >Ballalbagh, >Mangalore-575003=20 >Ph : 91-824-2451001/5 >Fax : 91-824-2451050=20 > > >DISCLAIMER: This message contains privileged and confidential information and is >intended only for the individual named.If you are not the intended >recipient you should not disseminate,distribute,store,print, copy or >deliver this message.Please notify the sender immediately by e-mail if >you have received this e-mail by mistake and delete this e-mail from >your system. > > > ------------------------------------------------------------------------ > > Hey, > create or replace function sample(varchar,int) returns varchar as' > declare > data alias for $1; > size alias for $2; > begin > return substr(data,(length(data)-size)+1,length(data)); > end; > ' language 'plpgsql'; > > ____________________________ > WARNING: plpgsql: ERROR during compile of sample near line 2 > ERROR: parse error at or near ";" > > Can any body tell me why is this error coming > >----- >Warm Regards >Sh=FFam Peri > >II Floor, Punja Building, >M.G.Road, >Ballalbagh, >Mangalore-575003=20 >Ph : 91-824-2451001/5 >Fax : 91-824-2451050=20 > > >=20=20 > > > > * DISCLAIMER: This message contains privileged and confidential=20 > information and is intended only for the individual named.If you are > not the intended recipient you should not=20 > disseminate,distribute,store,print, copy or deliver this=20 > message.Please notify the sender immediately by e-mail if you have=20 > received this e-mail by mistake and delete this e-mail from your system.* > >------------------------------------------------------------------------ > > >---------------------------(end of broadcast)--------------------------- >TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org >=20=20 > Hi, I juste did a copy/paste of your sample on my test DB. I didn't get any=20 error message and the function works fine. I run PostgreSQL 7.3.3 --=20 Jean-Michel Chabanne 77450 MONTRY (FRANCE) 48" 54' N - 2" 49' E Powered by Linux DISCLAIMER: This message contains privileged and confidential information a= nd is intended only for the individual named.If you are not the intended recipient you should not disseminate,distribute,store,print, copy or deliver this message.Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. ------=_Part_274_664745.1064057031920 Content-type: text/html Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename=Untitled1
5:08p
Dear All,
When I am executing any function with parame=
ter.. I am unable to access them. So, I would be thankful if, anyone can he=
lp me in teaching this aspect.
CREATE FUNCTION add_one (integer) RET=
URNS INTEGER AS '
BEGIN
&n=
bsp; RETURN $1 + 1;
END;
' LANGUAGE 'p=
lpgsql';
The expected ouput of the above function should be 11 when we pass the 1=
0 to it.... but it returns 1.
Thank you in advance
----- Warm Regards Sh=FFam Peri II Floor, Punja Building, M.G.Road, Ballalbagh, Mangalore-575003=20 Ph : 91-824-2451001/5 Fax : 91-824-2451050=20
sh= yamperi@davlin.co.in a =E9crit : >Hey, >create or replace function sample(varchar,int) returns varchar as' >declare > data alias for $1; > size alias for $2; >begin > return substr(data,(length(data)-size)+1,length(data)); >end; >' language 'plpgsql'; >____________________________ >WARNING: plpgsql: ERROR during compile of sample near line 2 >ERROR: parse error at or near ";" > >Can any body tell me why is this error coming >----- >Warm Regards >Sh=FFam Peri > >II Floor, Punja Building, >M.G.Road, >Ballalbagh, >Mangalore-575003=20 >Ph : 91-824-2451001/5 >Fax : 91-824-2451050=20 > > >DISCLAIMER: This message contains privileged and confidential information and is >intended only for the individual named.If you are not the intended >recipient you should not disseminate,distribute,store,print, copy or >deliver this message.Please notify the sender immediately by e-mail if >you have received this e-mail by mistake and delete this e-mail from >your system. > > > ------------------------------------------------------------------------ > > Hey, > create or replace function sample(varchar,int) returns varchar as' > declare > data alias for $1; > size alias for $2; > begin > return substr(data,(length(data)-size)+1,length(data)); > end; > ' language 'plpgsql'; > > ____________________________ > WARNING: plpgsql: ERROR during compile of sample near line 2 > ERROR: parse error at or near ";" > > Can any body tell me why is this error coming > >----- >Warm Regards >Sh=FFam Peri > >II Floor, Punja Building, >M.G.Road, >Ballalbagh, >Mangalore-575003=20 >Ph : 91-824-2451001/5 >Fax : 91-824-2451050=20 > > >=20=20 > > > > * DISCLAIMER: This message contains privileged and confidential=20 > information and is intended only for the individual named.If you are > not the intended recipient you should not=20 > disseminate,distribute,store,print, copy or deliver this=20 > message.Please notify the sender immediately by e-mail if you have=20 > received this e-mail by mistake and delete this e-mail from your system.* > >------------------------------------------------------------------------ > > >---------------------------(end of broadcast)--------------------------- >TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org >=20=20 > Hi, I juste did a copy/paste of your sample on my test DB. I didn't get any=20 error message and the function works fine. I run PostgreSQL 7.3.3 --=20 Jean-Michel Chabanne 77450 MONTRY (FRANCE) 48" 54' N - 2" 49' E Powered by Linux