Oracle Stored Procs, Binding Variables

admin

Administrator
Staff member
Hi folks,

I have an Oracle SP with the footprint:

function insert_company_details(
oApplication_number out integer,
sCOMPANY_NAME in varchar2 ,
sADDRESS in varchar2 ,
sPOSTCODE in varchar2 ,
sSUBURB in varchar2 ,
sSTATE in varchar2 ,
sCOUNTRY in varchar2 ,
sFAX_NUMBER in varchar2 ,
sPhone_prefix in varchar2,
sPHONE_NUMBER in varchar2 ,
sPHONE_EXTENSION in varchar2 ,
sEMAIL in varchar2 ,
sACN_NUMBER in varchar2 ,
sABN_NUMBER in varchar2 ,
sDUNS_NUMBER in varchar2 ,
sDOMAIN_NAME in varchar2 ,
sWEB_SERVER_VENDOR in varchar2 ,
sCHALLANGE_PHRASE in varchar2 ,
sINVOICE_NUMBER in varchar2 ,
sCSR in varchar2
) return integer;

I need to be able to a) Find out if the SP has executed successfully, and b) find the resulting "oApplication_number" value. I understand that I need to use OCIBindByName to do this, and can successfully bind to whether or not the SP executed or not, but I can't seem to bind successfully to "oApplication_number".

Some code which may or may not make things a bit clearer:
<?
PutEnv("ORACLE_SID=ESIGN");
PutEnv("ORACLE_HOME=/home/oracle/product/8.1.5");
$oracle = OCIPLogon("username", "password", "ESIGN"); // Connects ok, I can query

$sql = "begin "
." :result := esign_details.INSERT_COMPANY_DETAILS "
."( :x, '$orgn[name]', '$orgn[address]', '3333', "
." '$orgn[suburb]', '$orgn[state]', 'AUS', '$orgn[faxnumber]', "
." '$orgn[phonearea]', '$orgn[phonenumber]', '$orgn[phoneext]', "
." '$orgn[emailaddress]', '$orgn[acnnumber]', '$orgn[abnnumber]', "
." '$orgn[dunsnumber]', '$orgn[domain]', '$orgn[servervendor]', "
." '$orgn[challenge]', '$orgn[invoicenum]', '$orgn[csr]' ); "
."end;";
echo "$sql<BR>\n";

$statement = OCIParse($oracle, $sql);
echo $statement;

OCIBindByName($statement, ":result", &$result);
OCIBindByName($statement, ":x", &$x);

OCIExecute($statement); // This is line 49 in the full file.

echo "result: $result<BR>\n";
echo "X: $x<BR>\n";
?>

Can someone please help me with this? I'd prefer to take the conversation to private email since the forum is an annoying system to post to in conversations, but either way would be fine - I've been tearing my hair out all afternoon over it and can't work this out.
 
Back
Top