Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

PRO*C    Stored Procedure Call with Host Array Variable?

Posted on 2001-08-02
3
Medium Priority
?
1,596 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 80 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Why doesn't the Oracle optimizer use my index? Querying too much data Most Oracle developers know that an index is useful when you can use it to restrict your result set to a small number of the total rows in a table. So, the obvious side…
Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.
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.

715 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