Hello everybody,
I'm building a function that will import data into a postgresql db
(7.2.4). Now i have run into this problem: in my import module I do a
lot of checks to see if a value is empty or null. I want to solve this
with a function, something like this:
drop function is_empty();
create function is_not_empty() returns boolean as '
declare
begin
if $1 = NULL or $1 = '''' then
return true;
else
return false;
end if;
end; '
language 'plpgsql';
select is_empty();
true
select is_empty('');
true
select is_empty('Blah');
false
This won't work, pl wants to know at compile time which function
parameters there will be. Another problem is when I don't know the
datatype of the parameter or how many parameters there will be at
compile time.
Can anybody point me in the right direction? Thanks!
A more general matter. I have some finding answers to questions like
these in the material I have here (the pg documentation & website,
Bruce Momjians book, the PHP and Postgresql book, online books,
Google). Is there a book or website that will give in depth explanation
on pl/pgsql? TIA!