Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> How to write Pro*C makefile & Bind Host variable to type return from Stored Procedure

How to write Pro*C makefile & Bind Host variable to type return from Stored Procedure

From: Jesse Hwee <jessehwee_at_visto.com>
Date: 16 Jul 2001 19:58:57 -0700
Message-ID: <b7a7f007.0107161858.630a3f83@posting.google.com>

1)
I'm facing problem trying to create a Pro*C makefile. Hope to get your help on this.
I am doing development on Windows NT until the UNIX server is ready by end of August. My objective is to build 2 shared libraries from 2 sets of PRO*C programs. Then link them with the main PRO*C program. How to build them in WinNT(may be just a .proc link with main, but how to write this in a makefile) and Unix(.so) using Pro*C makefile?

Using Oracle8.1.5 on WinNT. Oracle8.1.5 on HP-UX in future. I am trying to modify the makefile you post online, but couldn't get it work. Firstly, the demo_proc.mk is not found in the directory, only the pcmake.bat.

I need help to produce 2 makefiles, 1 for WinNT and 1 for UNIX. The following is the modified makefile (from Thomas Kyte) for WinNT:



#
#
#setenv ORACLE_PROC_MAKEFILE

?$ORACLE_HOME/precomp/demo/proc/demo_proc.mk
#
#

ORACLE_HOME = d:\orant
#ORACLE_PROC_MAKEFILE = $(ORACLE_HOME)\precomp\demo\proc\demo_proc.mk

#name of program I want to create

TARGET = Conv
#list of .pc files I need to precompile/compile
# main source
# Conv.pc
# set 1 for shared library libCommon.so
# Common.pc, Validate.pc
# set 2 for shared library libConv.so
# Customer.pc, Accounts.pc, Products.pc, Orders.pc
#

SOURCE = IMConv.pc
#any settings I want to override at make time for ProC
PROC_ENV_FLAGS = sqlcheck=semantics userid=testuser/testuser parse=full
#any setting I want to override at make time for CC
CC_ENV_FLAGS = OBJS = COnv.o

$(TARGET): $(SOURCE) $(SOURCE:.pc=.c) $(SOURCE:.pc=.o)

   $(CC) $(LDFLAGS) -t -o $(TARGET) \
   $(SOURCE:.pc=.o) -L$(ORACLE_HOME)\lib $(PROLDLIBS)  

#include $(ORACLE_PROC_MAKEFILE)
 

PROCFLAGS= ireclen=255 lines=yes $(PROC_ENV_FLAGS) \

           include=$(ORACLE_HOME)\proc\lib PROFLAGS=$(PROCFLAGS)   CFLAGS=-I. -g $(CC_ENV_FLAGS)


2) If I am calling stored procedures from PRO*C, what are the compiling rules needed to add in other than sqlcheck=semantics?

3) Do I have to use DECLARE SECTION for host variables? Some examples use it, some don&#8217;t? It state in the doc that if MODE=ORACLE then this is not required. How to check this and what is this?

4) The datatype binding is a quite confusing. Feel that it is a bit

   too rigid. What is efficient and easiest way to do programming in    PRO*C calling stored procedure which returns types?

   There are example returning a cursor from stored procedure. That's    fine and understanding. But if I want to call a stored procedure    which returns a subtype:

   SUBTYPE srw_order IS order%ROWTYPE;

        SELECT
	      *
        INTO 
		   psrw_order
	FROM
		   order
	WHERE
                   order_no = pn_order_no;
   How can I return this in PRO*C?   

Thanks a lot. Received on Mon Jul 16 2001 - 21:58:57 CDT

Original text of this message

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