X-Original-To: pgsql-sql@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 5CF924758C9 for ; Mon, 28 Apr 2003 04:46:39 -0400 (EDT) Received: from nova.office.sageway.com.sg (adsl-210-193-27-71.qala.com.sg [210.193.27.71]) by postgresql.org (Postfix) with ESMTP id 70A6A474E42 for ; Mon, 28 Apr 2003 04:46:36 -0400 (EDT) Received: from pc66 ([192.168.1.243]) by nova.office.sageway.com.sg (8.11.6/8.11.6) with ESMTP id h3S8quE01019 for ; Mon, 28 Apr 2003 16:52:58 +0800 From: "lihao" To: Subject: Pl Pgsql problem Date: Mon, 28 Apr 2003 17:15:16 +0800 Message-ID: <001101c30d66$b00356e0$f301a8c0@pc66> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0012_01C30DA9.BE2696E0" X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.2616 Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-Spam-Status: No, hits=-1.4 required=5.0 tests=BAYES_30,HTML_80_90 version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-Archive-Number: 200304/404 X-Sequence-Number: 13105 This is a multi-part message in MIME format. ------=_NextPart_000_0012_01C30DA9.BE2696E0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Hi, I am using 7.1.3 on RedHat Linux 7.2. I try to create a trigger on the table, I wrote a function in plpgsql, which always fail on this sql command: select (''UPD'' || int2hex(nextval(''updid''), 8)) as v_updid; The function is like this: begin select (''UPD'' || int2hex(nextval(''updid''), 8)) as v_updid; if not found then raise exception ''Unable to get updid.''; end if; end; It give me this error when I trigger the function: NOTICE: Error occurred while executing PL/pgSQL function pg_fct_bf_ins_inf_article NOTICE: line 9 at SQL statement -- the SQL select command ERROR: parser: parse error at or near "$1" I can execute the SQL without problem. << select ('UPD' || int2hex(nextval('updid'), 8)) as v_updid; >> Can anyone help me to see what is the problem here. Li Hao ------=_NextPart_000_0012_01C30DA9.BE2696E0 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Hi,

 =

I am using 7.1.3 on RedH= at Linux 7.2.

 =

I try to create a trigge= r on the table, I wrote a function in plpgsql, which= always fail on this sql command:

 =

selec= t (''UPD'' || int2hex(nextval= (''updid''), 8)) as v_updid;=

 =

The function is like thi= s:

 =

begin=

        =     select (''UPD'' || int2hex(nextval(''updid''), 8)) as v_updid;=

        =     if not found then

        =          raise exception ''Unable to get updid.'';

        =     end if;

        end;

 =

It g= ive me this error when I trigger the function:

 =

NOTICE:  Error occurred while executing PL/= pgSQL function pg_fct_bf_ins_inf= _article

NOTICE:  line 9 at SQL statement   -- the SQL select command

ERROR:  parser: parse error at or near "$1"

 =

I can execute the SQL wi= thout problem.

<<

selec= t ('UPD' || int2hex(nextval('updid'), 8)) as v_updid;<= o:p>

>>

 =

Can anyone help me to see what is the problem here.

 =

Li Hao=

 

------=_NextPart_000_0012_01C30DA9.BE2696E0--