Solved

PRO*C    Stored Procedure Call with Host Array Variable?

Posted on 2001-08-02
3
1,511 Views
Last Modified: 2012-05-04
Can any one give me the sample code for calling stored procedure with the array host variable in PRO*C.
I need the source code of pro*C also the corresponding stored procedure.

For both Passing "array" in to the stored procedure and passing out of stored procedure.
 
Thanx,
0
Comment
Question by:mogunek
  • 2
3 Comments
 
LVL 2

Accepted Solution

by:
dbaora earned 20 total points
ID: 6352773
here's a suggestion:

create or replace package pkg_emp
is
     procedure update_emp_name(i_EMPNO in EMP.EMPNO%type,
                i_ENAME in EMP.ENAME%type);
end pkg_emp;
/

create or replace package body pkg_emp
is
     procedure update_emp_name(i_EMPNO in EMP.EMPNO%type,
                i_ENAME in EMP.ENAME%type)
     is
     begin
          update emp set ename = i_ENAME where empno = i_EMPNO;
     end;
end pkg_emp;
/


pro*C:
=-=-=-=
boolean update_emp(char* empno, char* ename) {
   EXEC SQL BEGIN DECLARE SECTION;
   //------------------------------
   char db_name[20];
   char db_empno[10];
   char db_ename[20];
   EXEC SQL END DECLARE SECTION;
   //------------------------------  

   // retrieve the database name ...

   if (empno == NULL)
     return false;

   strcpy(db_empno,empno);
   strcpy(db_ename,ename);

   EXEC SQL AT :db_name EXECUTE
     BEGIN
        pkg_emp.update_emp_name(:db_empno,:db_ename);
     END;
   END-EXEC;
   
   //check for db errors ...

   return true;
}
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7063684
Hi mogunek,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. If there is no objection or further activity, I will suggest to:

    Accept dbaora's answer.

mogunek, if you think your question was not answered at all, you can post a new comment here.  Community Support moderators will followup.

Please do not accept this comment as an answer!

EXPERTS: Your input and closing recommendations are REQUESTED.
==========
mogunek -- EE database cleanup volunteer
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7083008
Recommended disposition:

    Accept dbaora's answer.

DanRollins -- EE database cleanup volunteer
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Note: this article covers simple compression. Oracle introduced in version 11g release 2 a new feature called Advanced Compression which is not covered here. General principle of Oracle compression Oracle compression is a way of reducing the d…
Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.

685 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