Hi all,
I've written a stored procedure but am having trouble calling it.
The procedure name is called "insert_period" and I am calling using:
SELECT
insert_period(1::INTEGER,'2005-09-13'::DATE,'2005-09-15'::DATE,'unavailable_periods');
But am getting the error message:
-
ERROR: syntax e
Hi Gary,
I've actually just done the same thing - but for renting property. I've
implemented the constraint as a trigger (Before insert/update, for each row),
that first checks if the start_date is < end_date, and then performs a select
on the bookings table using the OVERLAPS function. If the
Thank you everybody for your help - You were indeed correct - Removing the DATE
worked, and ran the function from the client (Although now it fails in the
debugger). I'm a little concerned why this didn't work in EMS PostgreSQL
Manager debugger - I'll raise a bug tracker regarding this.
However
Hi Tom,
Thanks for the advice; But I'm still can't get it working. I only have three
variables: prop_id, new_start_date, new_end_date, and into_table. I've used the
regclass type, and I've tried changing new_start_date and new_end_date to nsd
and ned respectively, but still no luck. If there a
Just a quick addendum;
I'm finding the number of rows by using GET DIAGNOSTICS num_entries = ROW_COUNT
after I open the query, and then branching depending on this value - Is there
any issue with using this in conjunction with cursors and OPEN FOR SELECT? I've
just tried using OPEN FOR EXECUTE
Ok, the whole thing is done and dusted - Thank you everybody for your
input. Apologies if I sometimes missed the obvious. For the sake of
anyone having the same problems and happens across this post, I learned
that:
- The result of a cursor assignment cannot be row counted, unless you
iterate thro
You cannot count the number of rows in a cursor, unfortunately. I recently ran
in to this problem.
As far as I am aware, the only way to count them is to either iterate through
them,
or if you are only expecting one or two, perform multiple FETCHES and test if
the
record set returned is empty