Re: What is Pro*C

From: Jerome Grandjanny <grandjanny_at_ldg.bruyeres.cea.fr>
Date: 1996/01/10
Message-ID: <4d0sd7$m37_at_news.cea.fr>#1/1


In article <4brupm$gqv_at_cloner2.ix.netcom.com>, chuckh_at_ix.netcom.com (Chuck Hamilton) writes:
>What exactly is Pro*C and where do I get it? Or is it something that's
>automatically shipped with the RDBMS and I maybe I already have it
>unawares. (I have Oracle 7.1.6 on HP-UX.)
>
>If it's a C-like language, or C libs for accessing Oracle, I'd *love*
>to start using it. PL/SQL just doesn't cut it as a serious programming
>language.

Hi Chuck,

I guess you'll love Pro*C ...

Pro*C is an Oracle product (It is shipped whith RDBMS since all products are present on the distribution tape or CDROM, but you must buy a license to use it.)

Basically, Pro*C is a pre-compiler used in front of a C-compiler. Your Pro*C-program is a C-program containing calls to Oracle in an easy way. Example :

   EXEC SQL select empno, empname into :no, :name

            from employees where <condition> ;

The EXEC SQL keywords introduce an Oracle statement ( ending with a semi-colon ).

The statement 'into :no, :name' means 'store the result of the selection into C-variables no and name'. (These variables must have been declared inside an 'SQL declare section' ).

The example below is *VERY* simple but Pro*C has features like error contition control, NULL values testing, loops for multiple rows selects, and so on...

I've developped applications with Pro*C and I found it very convenient.

The main scheme for compiling a Pro*C program is :

   file.pc ------------> file.c ---------> file.o -----------> executable file

            Pro*c pass cc pass link pass

Pro*C actually transforms EXEC SQL statements into blocks of C source code containing internal structures initialization and calls to functions in a pro*c library.

Note : There is another mechanism for calling Oracle within a C program. This mechanism is called OCI (Oracle Call Interface). I think this is shipped with RDBMS without extra charge. But it is more difficult to program with it because it is not as High Level as Pro*C.

Hope this will help you for choosing a developpement method. Received on Wed Jan 10 1996 - 00:00:00 CET

Original text of this message