Re: [SQL] Problem calling stored procedure

2005-08-23 Thread neil.saunders
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

Re: [SQL] Problem calling stored procedure

2005-08-23 Thread neil.saunders
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

Re: [SQL] Problem calling stored procedure

2005-08-23 Thread neil.saunders
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

Re: [SQL] Problem calling stored procedure

2005-08-23 Thread Tom Lane
<[EMAIL PROTECTED]> writes: > OPEN cur_overlap FOR SELECT *, pg_class.RELNAME AS table FROM > calendar_entries WHERE (start_date, end_date) OVERLAP (new_start_date, > new_end_date) AND property_id = X AND pg_class.oid = tableoid; > The only thing I can think of is that when the query runs in the

Re: [SQL] Problem calling stored procedure

2005-08-23 Thread neil.saunders
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

Re: [SQL] Problem calling stored procedure

2005-08-22 Thread Stephan Szabo
On Mon, 22 Aug 2005 [EMAIL PROTECTED] wrote: > 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');

Re: [SQL] Problem calling stored procedure

2005-08-22 Thread Michael Fuhr
On Mon, Aug 22, 2005 at 03:17:02PM +0200, [EMAIL PROTECTED] wrote: > ERROR: syntax error at or near "$1" at character 70 > QUERY: SELECT * FROM bookings WHERE (start_date, end_date) OVERLAPS (DATE $1 > - interval '1 day', DATE $2 + interval '1 day') AND property_id = $3 LIMIT 1 > CONTEXT: PL/pgSQL

[SQL] Problem calling stored procedure

2005-08-22 Thread neil.saunders
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