Function problems redux

From: tony <tony(at)animaproductions(dot)com>
To: postgres list <pgsql-general(at)postgresql(dot)org>
Subject: Function problems redux
Date: 2001-11-05 09:23:10
Message-ID: 1004952190.10670.8.camel@vaio
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jean-Michel POURE 2001-11-05 10:33:48 Limitations on PGSQL
Previous Message Tom Kubi 2001-11-05 09:11:50 Stored procedures