problem with function return

From: "Florian Dickbauer" <florian(dot)dickbauer(at)students(dot)fh-vorarlberg(dot)ac(dot)at>
To: <pgsql-general(at)postgresql(dot)org>
Subject: problem with function return
Date: 2002-03-10 19:13:45
Message-ID: 000a01c1c867$b3e65d10$0e66aac1@dh.uclv.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Browse pgsql-general by date

  From Date Subject
Next Message Dave 2002-03-10 19:15:37 Re: Postgres not starting at boot(FreeBSD) - startup script
Previous Message Stephan Szabo 2002-03-10 19:05:49 Re: Referential Integrity Triggers