Solved

Oracle Pro C

Posted on 2002-07-02
2
999 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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

Working with Network Access Control Lists in Oracle 11g (part 1) Part 2: http://www.e-e.com/A_9074.html So, you upgraded to a shiny new 11g database and all of a sudden every program that used UTL_MAIL, UTL_SMTP, UTL_TCP, UTL_HTTP or any oth…
Shell script to create broker configuration file using current broker Configuration, solely for purpose of backup on Linux. Script may need to be modified depending on OS-installation. Please deploy and verify the script in a test environment.
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…
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Suggested Courses

631 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