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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Slight "I have some string, how lng it it, BTW, it's blue" question

Re: Slight "I have some string, how lng it it, BTW, it's blue" question

From: Andrew <andrewgothard_at_Nospamthanks.com>
Date: Thu, 08 Jun 2006 00:26:30 GMT
Message-ID: <W8Khg.4870$1Z2.1177@newsfe7-win.ntli.net>

"Malcolm Dew-Jones" <yf110_at_vtn1.victoria.tc.ca> wrote in message news:44870001_at_news.victoria.tc.ca...
> Andrew (andrewgothard_at_Nospamthanks.com) wrote:
>
> : Sorry it this isn't clear - the reasoning behind some of the use of
cursors
> : to mimic joins is way beyond me. but I'd always been given to believe
that
> : use of cursors was a total last resort, not a good standard approach.
>
> I assume you mean code like
> loop over cursor1 rows
> open cursor2(lookup_id_from_cursor1)
> loop over cursor2 rows
> -- in here we have the "joined" data from 1 and 2
> end loop 2
> close cursor2
> end loop 1
>
> A real join within an single sql statement would normally be much better
> than using plsql and cursors to access multiple tables and "join"ing them
> yourself.
>
> If you have to do a join over a database link then it maybe better to
> mimic the join yourself with something like the above, but I wouldn't
> assume that, it's just a thing to keep in mind. I would guess that each
> newer version of Oracle is probably reducing the number of occasions where
> that would be true.
>
> (i.e.) select *
> from table1 t1 , table2_at_dblink t2
> where t1.id=t2.id
>

Nah - we're tslkig a cursor for each tsble and iterting through them looking for joins.
Got asked for a panic fix - and even though I'd never dnoe PL/SQL - the job was (I thought) a piece of piss - assumed that it was a simple C

ASE (or IF) starement - when I saw the code "WHAT the F*** is THIS?"
Could not understand using cursors for something trivial - have to admit, did my head in b- bjust assumed that I'd missed a business issue and it was more complex than I realised. Nah - just obfusticated code. I've always thought that code should be like a Zen garden clear
minimal
functional
a path to understanding

less is more

surely our job is to make the confused and impossible elegsant and easy?

Hell - that was unusually eloquent for me - can I copyrighy it? Received on Wed Jun 07 2006 - 19:26:30 CDT

Original text of this message

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