Solved

Oracle Pro C

Posted on 2002-07-02
2
994 Views
Last Modified: 2009-12-16
Can someone tell a (Windows Based) Visual Basic Programmer the basics about how to compile and run an Oracle Pro C program on a Compaq Unix machine. I keep hearing something about a "Makefile" and pathing out my header files.....I was told the compiler is installed and have a source code file (I didn't write it..)
As usual, Boss wants something quick, no time to read the manual..

and Yes, I am out of my element here,...to say the least..

I appreciate any help...Thank you.
0
Comment
Question by:GeekMan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 3

Accepted Solution

by:
p_yaroslav earned 100 total points
ID: 7125338
Hi!

How does one compile a PRO*C program?
You can study the sample makefile provided by Oracle and construct your own, but it would probably be better to just use "make" to precompile and then compile your program in one step. Look at this Unix examples:
Oracle7:

  make -f $ORACLE_HOME/precomp/demo/proc/proc.mk build EXE=myprog OBJS=myprog.o

Oracle8:

  make -f $ORACLE_HOME/precomp/demo/proc/demo_proc.mk build EXE=myprog OBJS=myprog.o

NOTE: OBJS and EXE has to be entered in caps!!!

How can I tell Pro*C what directory my header files are in?
Is there some way to tell the Pro*C preprocessor to search other directories for include (*.h) files, similar to the C compiler switch "-I"? I am hoping to avoid having to change all of my #include statements...
As documented in the Pro*C manual (in the chapter called "Running the Precompiler") there is an INCLUDE flag that can be used for this. Look at this example:


  proc iname=inputfile.pc include=directory1 include=directory2...

What is an indicator variable and why should I use it?
Indicator variables are used to explicitly handle NULL values. When you SELECT or FETCH a NULL value into a host variable/array an "ORA-01405: fetched column values is NULL" run-time error will result.
This behaviour was introduced with Oracle7 when you recompiled your programs with the DBMS=V7 (the default) precompiler option.

One workaround for this is to use the NVL() function to prevent the selection of NULL values.

Example:


  EXEC SQL SELECT ENAME, SAL, COMM
           INTO   :emp_name, :emp_sal, :emp_comm:comm_indicator
           FROM   emp;
  if (comm_indicator == -1)
      pay = emp_sal;
  else
      pay = emp_sal + emp_comm;

How does one execute PL/SQL code from Pro*C?
Look at this example:
       EXEC SQL EXECUTE
            begin
              dbms_application_info.set_client_info('My C Program with embedded PL/SQL');
            end;
       END-EXEC;


Hope it helps!
Yaroslav
0
 

Author Comment

by:GeekMan
ID: 7159694
Thank you, sorry I took so long to accept....
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Row_number in SQL 6 58
join actual table rows based on the column 25 44
mask value when navigating 5 25
Oracle cluster . 1 25
Introduction A previously published article on Experts Exchange ("Joins in Oracle", http://www.experts-exchange.com/Database/Oracle/A_8249-Joins-in-Oracle.html) makes a statement about "Oracle proprietary" joins and mixes the join syntax with gen…
How to Create User-Defined Aggregates in Oracle Before we begin creating these things, what are user-defined aggregates?  They are a feature introduced in Oracle 9i that allows a developer to create his or her own functions like "SUM", "AVG", and…
This video shows how to recover a database from a user managed backup
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.

710 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question