Take a look at
http://www.postgresql.org/docs/8.3/interactive/plpgsql-cursors.html
and you'll find answer you need.
> I need to convert this cursor of Oracle to Postgres...
> I wait for your help!!
--
Best regards, Yuri.
--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make ch
Hi List,
I need to convert this cursor of Oracle to Postgres...
I wait for your help!!
*declare**
v_num_dep integer := &v_num_dep;
v_cont integer:=0;
cursor cursor_dep is
select *
from hr.employees
where hr.employees.department_id = v_num_dep;
reg_dep cursor_dep%rowtype;
beg
On Thu, Mar 13, 2008 at 5:54 PM, chester c young <[EMAIL PROTECTED]>
wrote:
> is there any way to share a cursor between sessions?
>
> I have a costly query whose records need to be visited by in order by n
> number of concurrent sessions, and am unable to find the best way of
> doing this.
>
> I'
is there any way to share a cursor between sessions?
I have a costly query whose records need to be visited by in order by n
number of concurrent sessions, and am unable to find the best way of
doing this.
I'd almost like to write a daemon that hands out the next record, but
that's a royal pain t
On Wed, Dec 28, 2005 at 04:37:21PM -0300, Don Croata wrote:
> Please, if someone recalls a link, book, piece of code or anything with info
> about this technique for PL/PgSQL (8.1), please let us know. We've been
> searching into google, groups.google, http://archives.postgresql.org and
> http://ww
Please, if someone recalls a link, book, piece of code or anything with info about this technique for PL/PgSQL (8.1), please let us know. We've been searching into google, groups.google,
http://archives.postgresql.org and http://www.postgresql.org/docs/8.1/interactive with no results. Most of the
On Wed, Dec 28, 2005 at 10:48:25AM -0500, Tom Lane wrote:
> Don Croata <[EMAIL PROTECTED]> writes:
> > It's a function who has a cursor and calls itself, but the problem raises
> > after the first recursion, when PgSQL complains:
>
> > ERROR: cursor "cur" already in use
>
> > Are the cursors kep
Don Croata <[EMAIL PROTECTED]> writes:
> It's a function who has a cursor and calls itself, but the problem raises
> after the first recursion, when PgSQL complains:
> ERROR: cursor "cur" already in use
> Are the cursors kept globally? or cached like TEMP TABLE?
Cursor names are global within a
Hi,
I've been trying to do recursion and cursors in PL/PgSQL (PostgreSQL 8.1). It's a function who has a cursor and calls itself, but the problem raises after the first recursion, when PgSQL complains:
ERROR: cursor "cur" already in use
Are the cursors kept globally? or cached like TEMP TABL
Just FYI, recent versions of PG use cursors internally for PL/pgSQL FOR
loops. So there is no danger for a procedure to run out of memory when
looping over a huge result set ... at least not because of that.
Jan
Dennis wrote:
Tom Lane writes:
Something like
LOOP
FET
On Sunday 11 April 2004 19:46, Dennis wrote:
> Tom Lane writes:
> > Something like
> >
> > LOOP
> > FETCH ...;
> > EXIT WHEN NOT found;
> > ...
> > END LOOP;
>
> Thank you! I tried finding documentation on "found" in this context and
> didn't come up with
Tom Lane writes:
Something like
LOOP
FETCH ...;
EXIT WHEN NOT found;
...
END LOOP;
Thank you! I tried finding documentation on "found" in this context and
didn't come up with anything. Can you point me to where it is documented?
"Dennis" <[EMAIL PROTECTED]> writes:
> I am wondering if I can use a cursor in a for loop.
Something like
LOOP
FETCH ...;
EXIT WHEN NOT found;
...
END LOOP;
should do it.
regards, tom lane
-
Hello,
I am wondering if I can use a cursor in a for loop. I haven't been able to
get it to work. I am just beginning plpgsql and I am struggling here.
I am trying to do this:
create or replace function ttest(varchar)
RETURNS varchar AS '
DECLARE
parId ALIAS FOR $1;
dennis varchar;
The follow code gives me Error:
DECLARE CURSOR_GET_ALL_CONFERENCE_RECORDS CURSOR FOR Select
ConferenceType,CallManagerId,ClusterId,DestConversationId,AppConfId,Fina
lDestination FROM Tmp_Conference;
OPEN CURSOR_GET_ALL_CONFERENCE_RECORDS;
FETCH FROM CURSOR_GET_ALL_CONFERENCE_RECORDS IN
Releases before 7.4 are spotty about supporting backwards scan of
complex queries --- if you have a join or aggregate in the query,
it likely won't work, yielding either strange errors or wrong answers.
It will work if the top plan node in the query is a SORT, though, so
a possible workaround is to
Tomasz Myrta <[EMAIL PROTECTED]> writes:
> I wanted to use some select result several times in pl/pgsql function.
> Neither move backward 1 in test;
> nor
> execute ''move backward 1 in test'';
> doesn't work.
Releases before 7.4 are spotty about supporting backwards scan of
complex queri
Hi
I wanted to use some select result several times in pl/pgsql function.
DECLARE
test refcursor;
x record;
BEGIN
open test for select...
fetch test into x;
while found loop
...work...
fetch test into x;
end loop;
...rewind cursor using move...
fetch test...
Neither move backward 10
Rod Taylor <[EMAIL PROTECTED]> writes:
> Enforcing spec seems like the least confusing mode to operate under,
> especially given it could break simply by changing the plan -- which
> happens automagically (seemingly random).
Keep in mind though that complaints about the current bugs have been
fair
> I'm presently leaning to #2, even though it exposes implementation
> details. I'm open to discussion though. Any preferences? Other ideas?
How about a variable that turns on or off spec enforcement (case #1 or
#2). On for 7.4, off for 7.5 the next release, and make it disappear
after that.
E
Tom,
> Postgres' implementation of cursors has always had a problem with doing
> MOVE or FETCH backwards on complex queries.
Coincidnetally enough, I was just chatting with one of my contractors
yesterday about how the one thing that Transact-SQL has to offer is a really
good cursor implementa
Postgres' implementation of cursors has always had a problem with doing
MOVE or FETCH backwards on complex queries. It works okay for simple
seqscans and indexscans, but fails for plans involving joins,
aggregates, and probably other cases. This happens because the executor
routines for those pla
Preeti,
> Is there a command in plpgsql similar to %NOTFOUND of oracle?
Cursors are not currently supported for PL/pgSQL. There are plans to
include them for and upcoming version of Postgres. But dont' wait your
application on it.
> i want to write a load script which takes each row from the
Hi
Is there a command in plpgsql similar to %NOTFOUND of oracle?
i want to write a load script which takes each row from the temporary
table, do some processing and insert into actual tables. Any idea how i
can accomplish this???
thank you
regards
Preeti
---(end of bro
24 matches
Mail list logo