Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: What syntax better (faster,cool)!
sokol_at_opsb.ru wrote:
>
> select COL into VAR from TABLE;
>
> or
>
> open CURSOR;
> fetch COL into VAR;
> close CURSOR;
Select...INTO... does two fetches on the database the other one to test for the exception TOO_MANY_ROWS. Open CURSOR, etc goes into the database once. The difference is in the cost of doing two database reads vs 3 operations(ie open, fetch, close). Personally, I think Open Cursor is better(esp. if the select is on a big table).
--
Siphiwe Muziwenkosi Memela <siphiwe_at_cm.co.za> Computer Management (Pty) Ltd. Durban, South Africa +--------------------------------------------------------+|****** Imagination is intelligence taking a walk *******|
+--------------------------------------------------------+Received on Tue Dec 08 1998 - 00:50:39 CST