Solved

Oracle Pro C

Posted on 2002-07-02
2
968 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
2 Comments
 
LVL 3

Accepted Solution

by:
p_yaroslav earned 100 total points
Comment Utility
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
Comment Utility
Thank you, sorry I took so long to accept....
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Solar Winds Database performance Analyzer 2 74
Left Justify field in Oracle 6 69
oracle global variables 4 51
Oracle Finace 3 43
Subquery in Oracle: Sub queries are one of advance queries in oracle. Types of advance queries: •      Sub Queries •      Hierarchical Queries •      Set Operators Sub queries are know as the query called from another query or another subquery. It can …
Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
This video explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.
This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…

772 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now