Solved

PRO*C    Stored Procedure Call with Host Array Variable?

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

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…
Have you ever had to make fundamental changes to a table in Oracle, but haven't been able to get any downtime?  I'm talking things like: * Dropping columns * Shrinking allocated space * Removing chained blocks and restoring the PCTFREE * Re-or…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
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…

746 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now