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: Pro*C Question - Newbie

Re: Pro*C Question - Newbie

From: Jeffery Cann <jcann_at_fairway.com>
Date: 1998/03/03
Message-ID: <34FC9C66.FE06FCCE@fairway.com>#1/1

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

Original text of this message

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