Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Pro*C Question - Newbie
naren.dasu_at_divatv.com wrote:
>
> Hi,
> I am trying to do this in Pro*C. I have a Table Empolyee with 10 records.
> I need to process them one by one. The prototype of the function would look
> like this :-
> GetFirstRecord(struct emp_table_type *emp_rec_ptr)
>
> To get the next record I would use
> GetNextRecord(struct emp_table_type *emp_rec_ptr).
>
> thanks in advance
Just curious, why do you want to use 2 functions for something that is really just a processing-loop?
I would think you would do something like:
declare cursor get_emp is
select blah,blah from employee
where blah = blah
open get_emp;
for (loop parameters)
fetch get_emp
into emp_rec;
iterate loop;
end loop;
close get_emp;
Checkout the example pro*c files: sample1.pc,sample2.pc, etc. There is a sample which does exactly what you want (with a different table) that would be instructive. Consult your "Programmer's Guide to the Oracle Pro*C/C++ Precompiler" manual for more info
good luck.
Jeff
-- Jeffery C. Cann Senior Software Engineer Fairway Systems, Inc.Received on Tue Mar 03 1998 - 00:00:00 CST