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

Home -> Community -> Mailing Lists -> Oracle-L -> Re: Bind Variable -- Implicit Cursor

Re: Bind Variable -- Implicit Cursor

From: Tim Gorman <tim_at_evdbt.com>
Date: Sat, 25 Dec 2004 10:10:08 -0700
Message-ID: <BDF2ED00.214E7%tim@evdbt.com>


Fahd,

You were almost there...

declare
  l_dummy all_objects.object_name%type;
begin
  for i in 1..1000 loop
    select object_name
    into l_dummy
    from all_object
    where object_id = i;
  end loop;
end;
/

Hope this helps...

-Tim

on 12/20/04 1:58 AM, Fahd Mirza at fahd-m_at_aero.com.pk wrote:

> Hi listers,
> I am afraid, I am going to ask a very simple question. I am trying to learn
> the Bind Variables. I know what are they and how they can be used in explicit
> cursor. But I am at loss at how they would he used in implicit cursor. E.g.
> the following PL/SQL block uses the bind variable explicit cursor and it works
> fine.
> declare
> type rc is ref cursor;
> l_rc rc;
> l_dummy all_objects.object_name%type;
> begin
> for i in 1...1000
> loop
> open l_rc for
> 'select object_name from all_object where object_id=:x' using i;
> fetch l_rc into l_dummy;
> close l_rc;
> end loop;
> end;
> /
>
>
> I want to use the bind variable ':x' in implicit cursor like this
>
> declare
> begin
> for i in (select object_name from all_object where object_id=:x' using i)
> loop
> end loop;
> end;
> /
> but the above code with For Loop cursor is giving errors. I would be extremely
> grateful for guidance.
>
> regards,
> Fahd
>
> --
> http://www.freelists.org/webpage/oracle-l
>

--
http://www.freelists.org/webpage/oracle-l
Received on Sat Dec 25 2004 - 11:04:46 CST

Original text of this message

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