Louis Foucart wrote:
> When I execute the function get_column as select * from
> get_column('dat', 1), I have a parse error like this:
> parse error at or near ";"
>
> Here is the code for the get_column() function:
>
> create or replace function get_column(char(3), int8) returns setof daf as
> '
> declare
> database alias for $1;
> begin
> if database = ''dat'' then
> select * from data_get_column($2);
> else if database = ''mat'' then
> select * from material_get_column ($2);
> else if database = ''act'' then
> select * from activity_get_column ($2);
> end if;
> end;
> '
> language 'plpgsql';
You don't have any "return next" or "return" statements in this
function. You need a "for x in statement loop", etc, just like you are
doing in data_get_column()
> Moreoever I want to make them better to return only one result of type
> daf as the primary key of data_columns is id. Can you help me to design
> this kind of function ?
I don't understand this question -- maybe an example of what you want to
do would help.
Joe