| From: | rudy <rudy(at)heymax(dot)com> |
|---|---|
| To: | pgsql-general(at)postgresql(dot)org |
| Subject: | CURSOR HELP |
| Date: | 2000-12-08 14:14:25 |
| Message-ID: | 3A30ECC1.C133BFA4@heymax.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
HELP. I apologize if this is too basic, but since I have next to zero
documentation on it I must ask... Can you declare and use CURSORs using
plpgsql? The documentation I have read seems to indicate that you can,
but I have not been able to get it to work. I can get a similar function
to work in SQL from the command prompt, but not when using a plpgsql
function. Here is a snippet of code:
DECLARE recur_events_curs CURSOR FOR
SELECT time_start,
time_end
FROM CHAT_EVENT
WHERE day_of_week = v_day_of_week
AND id_resource = v_id_resource;
v_this_start_time CHAT_EVENT.time_start%TYPE;
v_this_end_time CHAT_EVENT.time_end%TYPE;
IF v_end_time <= v_start_time THEN
/* Recurring event spans two days of the week */
v_use_end_time := v_end_time + 2400;
ELSE
v_use_end_time := v_end_time;
END IF;
/* First, determine if this event overlaps any recurring events */
OPEN recur_events_curs;
LOOP
FETCH recur_events_curs INTO v_this_start_time, v_this_end_time;
EXIT WHEN recur_events_curs ISNULL;
I always get an error on the "CURSOR" during compile of function.
Thanks,
Rudy
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Nathan Barnett | 2000-12-08 15:13:54 | Memory Usage |
| Previous Message | Tatsuo Ishii | 2000-12-08 11:23:26 | Re: ilike and --enable-multibyte=KOI8 |