Re: parse error when executing a simple plpgsql function
От | Joe Conway |
---|---|
Тема | Re: parse error when executing a simple plpgsql function |
Дата | |
Msg-id | 3ECB9C29.6020002@joeconway.com обсуждение исходный текст |
Ответ на | parse error when executing a simple plpgsql function (Louis Foucart <lfoucart@dcc.uchile.cl>) |
Список | pgsql-novice |
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
В списке pgsql-novice по дате отправления: