Function call should look something like:
SELECT * FROM findBookgins('FooBar' :: character varying);
Or
SELECT findBookings('Foo');
Or
Perform findBookings('Bar');
/* note this call will not return anything but
is only available when calling function from other functions */
Edit:
Okay let's look at the problem step by step.
First of all returning nothing:
Here's a perfectly good explanation about how function return works in postgresql
Next how to define function (since your code is pure sql
, i'm guessing you need a function in sql
aswell):
CREATE OR REPLACE FUNCTION findBookgins(prm_booking character varying(100))
RETURNS SETOF bookings AS
'SELECT * FROM bookings WHERE id = $1';
LANGUAGE sql VOLATILE
ROWS 1000;
This function should return all the bookings that match your given criteria as so:
SELECT * FROM findBookings('15');
will return all bookings with id 15.
I'm assuming that's what you're trying to do because otherwise your function wouldn't do anything, to use loops you need plpgsql
functions
More about plpgsql procedural language syntax here