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: PL/SQL

Re: PL/SQL

From: Jim Kennedy <jim>
Date: Sun, 21 May 2006 08:20:18 -0700
Message-ID: <I_mdnREJ_4QLGe3ZnZ2dnUVZ_t6dnZ2d@comcast.com>

"Bernd Eichelsdorf" <gandor_at_uni.de> wrote in message news:4470558f$0$11078$9b4e6d93_at_newsread4.arcor-online.net...
> Hi,
>
> At the moment I am trying to grasp PL/SQL,
> and I've read a few PL/SQL tutorials online -
>
> Now I've got a few questions, I really didn't understand...
>
> What I think I did grasp:
>
> Every SELECT query is stored internally in memory.
> A cursor is a pointer on it and you can use it to
> access each record of this "virtual table".
>
> 1. Is that correct?
> 2. When exactly do I need a cursor, and when don't I?
>
> Without a cursor, you have to use a select that returns exactly one
> row. But what if I put this SELECT statment into a loop and
> count up a variable for a variable in a WHERE condition of this
> statement - or what if I use a limit with a variable I count up?
> Wouldn't that do exactly the same?
>
> 3. What for do I need a PL/SQL table, and why does it only support
> one column - but on the other hand you can store a record in such a
> PL/SQL Table column, and so you get a full table again...
>
>
> 4. Where's the difference between a PL/SQL table and a cursor?
>
> thx,
>
> Bernd

You should try to operate on data in sets not in row by row processing. Think of row by row as slow by slow. That said there are times when you have to. If you want to process a billion row table you probably don't want to make a pl/sql table out of it. It would create a huge in memory table and probably cause a lot of swapping or exhaust RAM on the server. Think of a pl/sql table as an array. There are times when you use arrays and time you read from a file. These principals are SIMILAR (a table is NOT a file) to when you use a pl/sql table and when you would use a cursor. Jim Received on Sun May 21 2006 - 10:20:18 CDT

Original text of this message

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