From: | Dado Feigenblatt <dado(at)wildbrain(dot)com> |
---|---|
To: | Pgsql-Sql <pgsql-sql(at)postgresql(dot)org> |
Subject: | PLpgSQL |
Date: | 2001-07-20 19:26:22 |
Message-ID: | 3B5885DE.2070104@wildbrain.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
3 questions:
1. Can I use CREATE SEQUENCE inside a function?
2. I can create this function but I can't get it to run:
CREATE FUNCTION new_proj_pts_seq(int4)
RETURNS text
AS 'DECLARE
proj_ID alias for $1;
seq_name TEXT;
BEGIN
seq_name := ''proj_pts_'' || proj_ID;
create sequence seq_name;
END;
RETURNS seq_name;'
LANGUAGE 'plpgsql';
When I do
SELECT new_proj_pts_seq(9000);
I get:
ERROR: parser: parse error at or near "$1"
The same happens if I assign $1 to proj_ID (instead of aliasing), or
just use $1 in the string concatenation.
I always get the same message.
Considering that all the above is possible/fixable...
3. On the statement 'create sequence seq_name;', will 'seq_name' be
evaluated properly?
Thanks.
--
Dado Feigenblatt Wild Brain, Inc.
Technical Director (415) 553-8000 x???
dado(at)wildbrain(dot)com San Francisco, CA.
From | Date | Subject | |
---|---|---|---|
Next Message | Dado Feigenblatt | 2001-07-20 19:58:00 | Re: Get the tables names? |
Previous Message | Roberto Mello | 2001-07-20 18:27:15 | Re: Get the tables names? |