Function problems redux
Hello,
Here is my function. It takes two variables a_artiste(name, forename).
DECLARE
artiste_id individu.individu_id%TYPE;
nom ALIAS FOR $1;
prenom ALIAS FOR $2;
ival INTEGER := nextval('individu_serial');
art TEXT := 'artiste';
curr INTEGER := currval('individu_serial');
BEGIN
SELECT INTO artiste_id * FROM individu WHERE to_ascii(nom) ILIKE
to_ascii(individu.nom) AND to_ascii(prenom) ILIKE
to_ascii(individu.prenom) AND type ILIKE 'collection' OR type2 ILIKE
'artiste';
IF NOT FOUND THEN
INSERT INTO individu (individu_id,nom,prenom,type2) VALUES (ival, nom,
prenom, art)
RETURN curr;
END IF;
RETURN artiste_id;
END;
ERROR: parser: parse error at or near "return"
DEBUG: Last error occured while executing PL/pgSQL function a_artiste
DEBUG: line 11 at SQL statement
This works just fine for known artists but my IF NOT FOUND clause is
seriously broken
HELP =:-D
Cheers
Tony
--
RedHat Linux on Sony Vaio C1XD/S
http://www.animaproductions.com/linux2.html
Macromedia UltraDev with PostgreSQL
http://www.animaproductions.com/ultra.html
On 5 Nov 2001, tony wrote:
Hello,
Here is my function. It takes two variables a_artiste(name, forename).
DECLARE
artiste_id individu.individu_id%TYPE;
nom ALIAS FOR $1;
prenom ALIAS FOR $2;
ival INTEGER := nextval('individu_serial');
art TEXT := 'artiste';
curr INTEGER := currval('individu_serial');
BEGIN
SELECT INTO artiste_id * FROM individu WHERE to_ascii(nom) ILIKE
to_ascii(individu.nom) AND to_ascii(prenom) ILIKE
to_ascii(individu.prenom) AND type ILIKE 'collection' OR type2 ILIKE
'artiste';
IF NOT FOUND THEN
INSERT INTO individu (individu_id,nom,prenom,type2) VALUES (ival, nom,
prenom, art)
RETURN curr;
END IF;
RETURN artiste_id;
END;ERROR: parser: parse error at or near "return"
DEBUG: Last error occured while executing PL/pgSQL function a_artiste
DEBUG: line 11 at SQL statementThis works just fine for known artists but my IF NOT FOUND clause is
seriously broken
Don't you need a semicolon at the end of that insert into line in the
if not found?
there is a missing ; in the line
INSERT INTO individu (individu_id,nom,prenom,type2) VALUES (ival, nom,
prenom, art)
...
*********** REPLY SEPARATOR ***********
On 05-11-2001 at 10:23 tony wrote:
Show quoted text
Hello,
Here is my function. It takes two variables a_artiste(name, forename).
DECLARE
artiste_id individu.individu_id%TYPE;
nom ALIAS FOR $1;
prenom ALIAS FOR $2;
ival INTEGER := nextval('individu_serial');
art TEXT := 'artiste';
curr INTEGER := currval('individu_serial');
BEGIN
SELECT INTO artiste_id * FROM individu WHERE to_ascii(nom) ILIKE
to_ascii(individu.nom) AND to_ascii(prenom) ILIKE
to_ascii(individu.prenom) AND type ILIKE 'collection' OR type2 ILIKE
'artiste';
IF NOT FOUND THEN
INSERT INTO individu (individu_id,nom,prenom,type2) VALUES (ival, nom,
prenom, art)
RETURN curr;
END IF;
RETURN artiste_id;
END;ERROR: parser: parse error at or near "return"
DEBUG: Last error occured while executing PL/pgSQL function a_artiste
DEBUG: line 11 at SQL statementThis works just fine for known artists but my IF NOT FOUND clause is
seriously brokenHELP =:-D
Cheers
Tony--
RedHat Linux on Sony Vaio C1XD/S
http://www.animaproductions.com/linux2.html
Macromedia UltraDev with PostgreSQL
http://www.animaproductions.com/ultra.html---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?
You wrote:
there is a missing ; in the line
INSERT INTO individu (individu_id,nom,prenom,type2) VALUES (ival, nom,
prenom, art)
I got that one after hitting send... sorry
Now on to todays question:
how do I get currval and nextval to work in pl/pgsql? They seem to be stuck and won't update during the session.
Cheers
Tony Grant
--
tony@animaproductions.com
JWebMail WebMail/Java v0.7.6 WWW to Mail Gateway
From pgsql-general-owner@postgresql.org Tue Nov 6 09:54:05 2001
Received: from news.tht.net (news.hub.org [216.126.91.242])
by postgresql.org (8.11.3/8.11.4) with ESMTP id fA667Mq96832
for <pgsql-general@postgresql.org>; Tue, 6 Nov 2001 01:07:22 -0500 (EST)
(envelope-from news@news.tht.net)
Received: (from news@localhost)
by news.tht.net (8.11.4/8.11.4) id fA65we906830
for pgsql-general@postgresql.org; Tue, 6 Nov 2001 00:58:40 -0500 (EST)
(envelope-from news)
From: "Rudy Amid" <radix33@hotmail.com>
X-Newsgroups: comp.databases.postgresql.questions
Subject: postgres 7.1.1 on Freebsd 4.3?
Date: Mon, 5 Nov 2001 21:58:37 -0800
Organization: Home Sweet Home
Lines: 20
Message-ID: <9s7u6e$6lb$1@news.tht.net>
X-Complaints-To: scrappy@hub.org
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
To: pgsql-general@postgresql.org
X-Archive-Number: 200111/208
X-Sequence-Number: 17207
I hope I got the right newsgroup to ask this question, so here goes:
Anyone got Postgres 7.1.1 to work under FreeBSD 4.3? It compiled fine but
here's what I got when I ran postmaster:
IpcMemoryCreate: shmget(keyT32001, size36992, 03600) failed: Cannot
allocate memory
The Postgres FAQ states that my kernel may not have enough (~10Mb) of shared
memory, but to my dismay, I also can't figure out how to tweak that on the
freebsd kernel config.
If anyone ran across this problem before and have a solution, please let me
know.
Thanks!
Rudy
Import Notes
Resolved by subject fallback