Solved

PRO*C    Stored Procedure Call with Host Array Variable?

Posted on 2001-08-02
3
1,556 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
[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
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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

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…
From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.
Suggested Courses

623 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