Could someone help me and give me a basic example of
how to write a similiar functional function to the one
below that would use a dynamic table and update a
column only if it held a value.
I've been reading around and can't seem to find the
answer I'm looking for. I just need a simple examle to
build upon. I would rather not use plpgsql if
possible. Tom mentioned the other pl's don't need
EXECUTE or something like that and would prefer clean
syntax if possible.
Thanks a bunch
CREATE OR REPLACE FUNCTION updatefoo(tbl
varchar, data mydata, myid bigint) RETURNS
boolean AS $$
DECLARE
BEGIN
update ${tbl} set
f1 = mydata.f1
IF mydata.f2 IS NOT NULL THEN
,f2 = mydata.f2
END IF;
WHERE id = myid;
IF NOT FOUND THEN
return false;
END IF;
return true;
END
$$ LANGUAGE ?;
__________________________________
Yahoo! Mail - PC Magazine Editors' Choice 2005
http://mail.yahoo.com