Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: cursor variable
Daniel gave it to you.
But you still have to know the column names if you want to do something with
the data you retrieve. Otherwise there's not much you can do...
-- Syltrem OpenVMS 7.3-1 + Oracle 8.1.7.4 http://pages.infinit.net/syltrem (OpenVMS related web site, en français) ---zulu is not in my email address--- "Alex" <alexk84_at_hotmail.com> a écrit dans le message de news:57d3e820.0402201129.336c9bf_at_posting.google.com...Received on Fri Feb 20 2004 - 14:14:00 CST
> Thanks for your input, but I'm looking for a more generic way to do
> what you described. The problem is I don't know the fields that are
> going to be pulled back. I'm trying to write a program that will
> allow me to pass various select statements into the cursor variable
> and retrieve the data without knowing the return type.
>
> Alex
>
> "Syltrem" <syltremzulu_at_videotron.ca> wrote in message
news:<WspZb.74$YV6.393_at_tor-nn1.netcom.ca>...
> > Type Emp_Rec_Type
> > is Record (
> > Emp_No EMP.Emp_Number%type.
> > Emp_Name EMP.NAME%type);
> > v_cur_Dat Emp_Rec_Type;
> >
> > you do your fetch
> >
> > and then you can access what you've just read from
> > v_cur_dat.emp_no and v_cur_dat.emp_name
> >
> > --
> > Syltrem
> >
> > OpenVMS 7.3-1 + Oracle 8.1.7.4
> > http://pages.infinit.net/syltrem (OpenVMS related web site, en français)
> > ---zulu is not in my email address---
> > "Alex" <alexk84_at_hotmail.com> a écrit dans le message de
> > news:57d3e820.0402200512.361c5e75_at_posting.google.com...
> > > I'm trying to execute a dynamic SQL statement using a ref cursor
> > > variable. The following is a simple example of what I'm trying to
> > > accomplish. I'd like to know how to declare the variable v_cur_dat to
> > > be able to accept any output, not only from table emp? Thanks in
> > > advance for your help.
> > >
> > > Alex
> > >
> > >
> > > DECLARE
> > >
> > > TYPE ref_cur_type IS REF CURSOR;
> > > v_cur ref_cur_type;
> > >
> > > v_cur_dat ??????
> > >
> > > BEGIN
> > > OPEN v_cur FOR SELECT * FROM emp;
> > >
> > > FETCH v_cur INTO v_cur_dat;
> > >
> > > END;