Home » Developer & Programmer » Precompilers, OCI & OCCI » Unable to pass host-structure as argument to stored procedure in Pro*C/C++
Unable to pass host-structure as argument to stored procedure in Pro*C/C++ [message #93503] Sat, 23 March 2002 02:58 Go to next message
Harshal Hayatnagarkar
Messages: 1
Registered: March 2002
Junior Member
Hello Everybody,

Help needed!.

I am unable to pass a host-structure instance to the
stored procedure as an argument.

The Pro*C and PL/SQL codes are given below.

Thanks in advance.

Regards,

Harshal
=======
------------------ Pro*C/C++ -------------------------
#include "sqlca.h"

/* For declare_handler() and connect_oracle ( ) */
#include "proc_util.h"

int main ( )
{
EXEC SQL BEGIN DECLARE SECTION ;
struct eror_type
{
char id[[5]];
char prgid[[8]];
char msg[[30]];
}obj;

EXEC SQL END DECLARE SECTION ;

declare_handler ( ) ;
connect_oracle ( ) ;

memset ( &obj , 0 , sizeof ( obj ) ) ;

/* Calls a stored procedure demo_procedure which
does nothing, but to take
one parameter */
EXEC SQL EXECUTE
BEGIN
demo_procedure ( :obj ) ;
END;
END-EXEC;

printf ( "ID = %s , PRGID = %s, MSG = %sn" ,
obj.id , obj.prgid , obj.msg ) ;
return 0 ;
}
------------------ PL/SQL ----------------------

create or replace package eror_pack
as
procedure proc_inout( eror_objt out excep%rowtype ) ;
end;
/
create or replace package body eror_pack
as
procedure proc_inout( eror_objt out excep%rowtype )
as
begin
end;
end;
/
---------------------------------

----------------- SQL ---------------------------
create table excep (
ID NUMBER(5)
PRGID VARCHAR2(8)
MSG VARCHAR2(30) );
---------------------------------------------------
Re: Unable to pass host-structure as argument to stored procedure in Pro*C/C++ [message #93524 is a reply to message #93503] Tue, 07 May 2002 20:44 Go to previous message
K.V.Sridhar
Messages: 1
Registered: May 2002
Junior Member
Hai,
It is not possible to pass a host structure to a PL/SQL stored procedure as an argument. Because PL/SQL can't recognise the structure declared in a host language. Declare a PL/SQL structure which matches the host structure and copy the host structure into PL/SQL structure. Then pass the PL/SQL structure as an argument to the stored procedure. This will solve the problem.

Regards
Sridhar
Previous Topic: reading the Precompiler config file
Next Topic: The incorrect no of records in fetch
Goto Forum:
  


Current Time: Sun Nov 24 13:25:31 CST 2024