Passing IN/OUT parameter to stored procedure from C++

From: Budtse <budtse_at_pi.be>
Date: 15 Dec 2003 08:38:54 -0800
Message-ID: <96c6ea0d.0312150838.356d45b1_at_posting.google.com>



Hi All,

I'm trying to pass an IN OUT parameter to a stored procedure from C++.  The parameter is actually a table, the stored procedure is defined : AS
  TYPE TBL_VALUES IS TABLE OF VARCHAR2(240) INDEX BY BINARY_INTEGER;   PROCEDURE ask_question ( l_params IN OUT TBL_VALUES );

I first tried to use 2 separate tables, 1 for IN and 1 for OUT parameters, and this worked fine. Now I should get it to work with a single table as IN OUT, but this doesn't seem to work (works OK from SQL*Plus, but in Visual C++ I get an error 'ORA-01405: fetched column value is NULL').
Here's how I define the statement:

        char* statement = "BEGIN xxoti_mes_utl_pk.ask_question( :l_params); END;";

	check_oci_error( OCIHandleAlloc( m_henvironment, 
		(dvoid**)&m_hstatement, OCI_HTYPE_STMT, 0, NULL ));
	check_oci_error( OCIStmtPrepare( m_hstatement, 
		m_herror, (text*)statement, strlen(statement), 
		OCI_NTV_SYNTAX, OCI_DEFAULT ));
	check_oci_error( OCIBindByName( m_hstatement, &m_hbind_1, 
		m_herror, (text*)":l_params", -1, &m_in_array[0][0],
		LEN_PARAMETERS, SQLT_STR, 0,0,0,
		MAX_PARAMETERS, &m_in_values_count, OCI_DEFAULT ));
	check_oci_error( OCIBindArrayOfStruct( m_hbind_1,
		m_herror, LEN_PARAMETERS, 0, 0, 0 ));

And I execute it with :

	check_oci_error( OCIStmtExecute( m_hservice_context,
		m_hstatement, m_herror, 1, 0, NULL, NULL, OCI_DEFAULT ))

Any hints please ?

Thanx in advance,
Budtse Received on Mon Dec 15 2003 - 17:38:54 CET

Original text of this message