pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Help with plpgsql - subst variable value
2+ messages / 2 participants
[nested] [flat]

* Help with plpgsql - subst variable value
@ 2001-02-22 14:45  Alexander Bodnar <bodnar@malva.com.ua>
  0 siblings, 0 replies; 2+ messages in thread

From: Alexander Bodnar @ 2001-02-22 14:45 UTC (permalink / raw)
  To: pgsql-general@postgresql.org; pgsql-interfaces

Hi all.

This my code snapshot:

CREATE FUNCTION CreateObject(varchar(600)) RETURNS int4 AS '
  DECLARE
   . . .
    ObjectSeqName text;
  BEGIN
  . . ..
      ObjectSeqName := ''ObjectLog'' || ObjectID || ''_Seq'';
     CREATE SEQUENCE ObjectSeqName start 1 increment 1 maxvalue 2147483647
minvalue 1 cache 1 CYCLE;
 . . .
    END IF;
    RETURN ObjectID;
    END;
' LANGUAGE 'plpgsql';

When I run this function I got
   ERROR:  parser: parse error at or near "$1"

So how can get value of ObjectSeqName in sequence/table/etc. name?




^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Help with plpgsql - subst variable value
@ 2006-08-01 21:37  Christopher Steffen <Christopher.Steffen@noaa.gov>
  0 siblings, 0 replies; 2+ messages in thread

From: Christopher Steffen @ 2006-08-01 21:37 UTC (permalink / raw)
  To: bodnar@malva.com.ua; +Cc: pgsql-general@postgresql.org; pgsql-interfaces

*Alexander Bodnar
*
Try
ObjectSeqName TEXT :=  foobar;
EXECUTE 'CREATE SEQUENCE ' || ObjectSeqName || ' start 1 increment 1 
maxvalue 2147483647';

Thanks,
Chris Steffen



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2006-08-01 21:37 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-02-22 14:45 Help with plpgsql - subst variable value Alexander Bodnar <bodnar@malva.com.ua>
2006-08-01 21:37 Re: Help with plpgsql - subst variable value Christopher Steffen <Christopher.Steffen@noaa.gov>

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