Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Resetting Cursors?

Re: Resetting Cursors?

From: Daniel Clamage <dclamageNOSPAM_at_telerama.com>
Date: 28 Jun 1998 19:03:46 +0400
Message-ID: <01bda2bf$0bb9c860$6829c9cd@saturn>


Sounds like you are doing a cartesian product, every row in one table concatenated with every row in another table. If there are m rows in table A and n rows in table B, joining A to B yields m*n #rows. Is this really what you want? Usually, you join on key columns, so that the concatenated rows are meaningful.

select * from emp, dept; -- cartesian product (all combinations of rows) select emp.deptno, emp.empno, emp.ename, dept.dname -- join based on key columns
from dept, emp -- only combinations of rows that make sense where
dept.deptno = emp.deptno; -- matching dept row for foreign key in emp

Lisa Lewis <lewis_at_med.pitt.edu> wrote in article <6mltah$p7l$1_at_usenet01.srv.cis.pitt.edu>...
> Is there a way to reset a cursor without opening and closing it. I want
to
> do a comparison of every row in a table with every other row in the table
> via 2 cursors (kind of like a double for loop). So I will want to fetch
> through all the records of the inner loop's cursor for every record in
the
> outer loop's cursor. Can I just reset the inner cursor so that I don't
have
> to open and close. I understand that opening the cursor causes the SQL
> statement associated with the cursor to execute. I don't want this to
occur
> once for every record in the table. Any insight/solutions would be
greatly
> appreciated.
> (This post is related to a previous post)
> Thanks very much!
>
>
>
>
Received on Sun Jun 28 1998 - 10:03:46 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US