problem with function return
От | Florian Dickbauer |
---|---|
Тема | problem with function return |
Дата | |
Msg-id | 000a01c1c867$b3e65d10$0e66aac1@dh.uclv.net обсуждение исходный текст |
Список | pgsql-general |
Hi,
i have a problem with writing functions in SQL.....
I tried to write a function like this:
create function evaluate(text, text, text) returns setof text as '
Then some SQL Statements which should return a table with 4 columns, containing the information i want. But i don´t know which return type i have to define for muptiple columns and i couldn´t find it in the manual.
' language sql;
And i also have a second problem. The parameters i want to give to my function are strings and i need them in my statements, but that doesn´t seem to work the way that i want.
Example:
and ru.category like $1
or
and ra.gender like $2
The complete code that i have until now took my a long time and it doesn´t seem to work. Maybe someone can tell me what i´m doing wrong. The code is:
create or replace function ergebnis(text, text, text) returns setof text as '
select m.firstname, m.lastname, ru.rank, ra.total
from members m, runs ru, races ra
where ru.membernr=m.membernr
and ru.raceid=ra.id
and ra.name like $1 (I know this doesn´t work but i don´t know why)
and ru.category like $2
and ru.rank>0
and m.gender like $3
order by ru.rank;
' language sql;
I hope someone can tell me what i´m doing wrong.
greetings, Florian Dickbauer
В списке pgsql-general по дате отправления: