pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: gordoncl@optusnet.com.au
To: pgsql-sql@postgresql.org
Subject: Probs "compiling" a function
Date: Tue, 08 Oct 2002 12:14:10 +1000
Message-ID: <200210080214.g982EAt24326@mail019.syd.optusnet.com.au> (raw)

Greetings, Having probs just "compiling" this fn and it comes back with a very
stark error msg which is below. I'm using version 7.1.3

I run the script as:
\i procedures/zff

and get the error msg:
psql:procedures/zff:51: ERROR:  parser: parse error at or near "b"

Line 51 is the line that starts LANGUAGE....

And the script is:
CREATE FUNCTION bsub_insert(varchar,varchar,varchar,varchar,varchar,
  varchar,varchar,varchar,varchar,varchar,bool,date,int2,int4,varchar,int4)
RETURNS integer AS '
DECLARE
    tmp_bsub	RECORD;
    t_sub_id2	INTEGER;
    t_class_sun INTEGER;
    p_band_nm	ALIAS FOR $1;
BEGIN
    IF p_band_nm IS NULL THEN
        RETURN 0;
    END IF;
    IF $3 IS NULL THEN
        RETURN 0;
    END IF;
    IF $4 IS NULL THEN
        RETURN 0;
    END IF;
    IF $11 IS NULL THEN
        RETURN 0;
    END IF;
    IF $12 IS NULL THEN
        RETURN 0;
    END IF;
    IF $15 IS NULL THEN
        RETURN 0;
    END IF;

    SELECT INTO tmp_bsub *
    FROM sub_class
    WHERE sub_class.class_ds = upper($15);
    IF NOT FOUND THEN
        RETURN -1;
    END IF;
    t_class_sun := tmp_bsub.class_sun;

    INSERT INTO sub(band_commnty_nm,street_no,first_nm,surname,home_phone_no,
      work_phone_no,mobile_phone_no,email_tx,web_addr_tx,sub_comment,
      voluntr_fl,sub_expiry_dt,card_cnt,receipt_no,sub_type_ind,
      class_sun,street_sun)
    VALUES(upper($1),$2,upper($3),upper($4),$5,$6,$7,$8,$9,upper($10),$11,
      $12,$13,$14,/'B/',t_class_sun,$16);

    GET DIAGNOSTICS t_sub_id2 = RESULT_OID;
    SELECT INTO tmp_bsub *
    FROM sub
    WHERE oid = t_sub_id2;

    RETURN tmp_bsub.sub_no;
END; '
LANGUAGE 'plpgsql';

Thanks for any help as this is driving me made and I've rewritten it checked all
the b's and compared it to other fns I've written and nothing I'm using here I
haven't already used.

Cheers...Gordon



view thread (2+ messages)  latest in thread

Message-ID: <200210080214.g982EAt24326@mail019.syd.optusnet.com.au>
Permalink:  ../200210080214.g982EAt24326@mail019.syd.optusnet.com.au/
Also on:    postgresql.org/message-id/200210080214.g982EAt24326@mail019.syd.optusnet.com.au

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: gordoncl@optusnet.com.au
  Subject: Re: Probs "compiling" a function
  In-Reply-To: <200210080214.g982EAt24326@mail019.syd.optusnet.com.au>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox