El Dom 19 Oct 2003 18:25, Alvaro Herrera escribió:
On Sat, Oct 18, 2003 at 06:48:10PM -0300, Martin Marques wrote: We are trying to make some things work with plpgsql. The problem is that
I built several functions that call one another, and I thought that the
way of calling it was just making the assign:
var:=func1(arg1 ,arg2);
Have you tried plpgsql's SELECT INTO ?
OK, let me be more specific. I tried this aready with this error:
2003-10-20 09:28:05 [27039] ERROR: parser: parse error at or near ")" at
character 15
2003-10-20 09:28:05 [27039] WARNING: plpgsql: ERROR during compile of
objetosdatosact ualizadicc near line 2
Now, here are the specifications about my function.
I'm building a function that does things with the fields of each row inserted.
This function is called from a Trigger. Also, this function calls another
function with does the actual job (well, it really cals some other functions,
all writen in plpgsql).
Here's the code:
CREATE OR REPLACE FUNCTION objetosdatosAct ualizaDicc() RETURNS TRIGGER AS '
DECLARE
newPk INT;
oldPk INT;
newVcampo VARCHAR;
oldVcampo VARCHAR;
salida RECORD;
BEGIN
IF TG_OP = ''UPDATE'' OR TG_OP = ''INSERT'' THEN
newPk := NEW.codigo;
newVcampo := NEW.titulo;
END IF;
IF TG_OP = ''UPDATE'' OR TG_OP = ''DELETE'' THEN
oldPk := OLD.codigo;
oldVcampo := OLD.titulo;
END IF;
SELECT INTO salida
actualizarDicci onario(newPk,ne wVcampo,oldPk,o ldVcampo,
''biblioteca'', ''titulo'',TG_R ELNAME,TG_OP);
RETURN NEW;
END;
' LANGUAGE 'plpgsql';
(actualizarDicc ionario is declared like this:
actualizarDicci onario(INT,INT, INT,INT,VARCHAR ,VARCHAR,VARCHA R,VARCHAR)
)
This is what's giving me the error:
2003-10-20 09:28:05 [27039] ERROR: parser: parse error at or near ")" at
character 15
2003-10-20 09:28:05 [27039] WARNING: plpgsql: ERROR during compile of
objetosdatosact ualizadicc near line 2
If I change the last SELECT INTO for a PERFORM I don't get the error, but I
also don't get the things from actualizarDicci onario() done (as if it wasn't
executed).
--
09:28:01 up 17 days, 19:00, 3 users, load average: 0.33, 0.38, 0.36
-----------------------------------------------------------------
Martín Marqués |
mm******@unl.ed u.ar
Programador, Administrador, DBA | Centro de Telematica
Universidad Nacional
del Litoral
-----------------------------------------------------------------
---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to
ma*******@postg resql.org so that your
message can get through to the mailing list cleanly