From: | Niclas Hedell <nick(at)ergodos(dot)com> |
---|---|
To: | pgsql novice <pgsql-novice(at)postgresql(dot)org> |
Subject: | get the oid |
Date: | 2003-03-10 16:49:41 |
Message-ID: | p05200f02ba926fc45c53@[192.168.0.25] |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
Hi list,
I'm not only a novice to pgsql but also to sql in general (as well as
new in this list)...
Here's my question: Why doesn't the following function work?
create function getoid(name) returns integer as '
declare
ret integer;
tablename alias for $1;
begin
select into ret oid from tablename;
return ret;
end;'
language 'plpgsql';
The idea is to get the oid (or whatever) from a table given by its
name as a parameter to the function. It seems that the 'from' clause
can't get the right table when passing a variable with the table
name. I've tried everything to get this to work (castings,
subqueries, etc, etc,...)
Thanx in advance! :-)
Cheers,
Nick
From | Date | Subject | |
---|---|---|---|
Next Message | Delao, Darryl W | 2003-03-10 19:21:48 | Re: General Performance questions |
Previous Message | Joe Conway | 2003-03-10 16:46:25 | Re: Value of sequence last inserted |