Solved

PRO*C    Stored Procedure Call with Host Array Variable?

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

Question has a verified solution.

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

Suggested Solutions

Working with Network Access Control Lists in Oracle 11g (part 2) Part 1: http://www.e-e.com/A_8429.html Previously, I introduced the basics of network ACL's including how to create, delete and modify entries to allow and deny access.  For many‚Ķ
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 explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

867 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

15 Experts available now in Live!

Get 1:1 Help Now