Re: [PHP4BETA] OCI8 help?
| From: | thies at digicol dot de | Date: | Tue, 14 Mar 2000 06:47:10 +0000 |
| Subject: | Re: [PHP4BETA] OCI8 help? | ||
| References: | 1 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-12083@lists.php.net to get a copy of this message | ||
binding of arrays is not supported (yet). i don't know when
it will be supported as i don't have time to look into that.
tc
PS: volunteers for implenting this are welcome, but you would
have to have some ddep OCI and PHP/Zend knoledge.
On Mon, Mar 13, 2000 at 07:43:16PM -0800, php@home.uh.nu wrote:
> Howdy,
> I'm having a problem making a call to a stored procedure using php4.
> I'm getting an error from plsql
> Warning: OCIStmtExecute: ORA-06550: line 1, column 7: PLS-00306: wrong number or types of
> arguments in call to
> 'DO_PURCHASE' ORA-06550: line 1, column 7: PL/SQL: Statement ignored in
> /usr/www/site/htdocs/rc/php/rcClass_Rocketpay.php on line 189
>
> I have checked the number of arguments and they are correct. The only thing I can think of,
> is that calling a stored procedure with some parameters as a php array doesn't work.
> In PRO C I can call an oracle stored procedure with one of the parameters being an
> array of strings or array of ints, depending on the parameter in question. So how can I call
> this
> stored procedure correctly in php? Here is the code in question.
>
> The stored proc is defined as
> SQL> desc do_purchase;
> PROCEDURE do_purchase
> Argument Name Type In/Out Default?
> ------------------------------ ----------------------- ------ --------
> I_MERCHANT_ID NUMBER(20) IN
> I_LOGON_NAME VARCHAR2(20) IN
> I_PASSWORD VARCHAR2(20) IN
> I_NUMBER_OF_ITEMS NUMBER IN
> I_SKU TABLE OF VARCHAR2(20) IN
> I_DESCRIPTION TABLE OF VARCHAR2(100) IN
> I_QUANTITY TABLE OF NUMBER IN
> I_COST TABLE OF NUMBER IN
> I_PURCHASE_ITEM_AMOUNT NUMBER IN
> I_PURCHASE_SHIPPING NUMBER IN
> I_PURCHASE_TAX NUMBER IN
> I_DISCOUNT NUMBER IN
> I_PURCHASE_TOTAL NUMBER IN
> O_TRANSACTION_ID NUMBER(20) OUT
> O_FINAL_BALANCE NUMBER OUT
> O_FIRST_NAME VARCHAR2(100) OUT
> O_MIDDLE_INITIAL VARCHAR2(10) OUT
> O_LAST_NAME VARCHAR2(50) OUT
> O_STREET1 VARCHAR2(100) OUT
> O_STREET2 VARCHAR2(100) OUT
> O_CITY VARCHAR2(100) OUT
> O_STATE VARCHAR2(2) OUT
> O_ZIPCODE VARCHAR2(10) OUT
> O_DAY_PHONE VARCHAR2(20) OUT
> O_EMAIL VARCHAR2(50) OUT
> O_RESULT_CODE NUMBER OUT
>
> The parameters in question are I_SKU, I_DESCRIPTION, I_QUANTITY, and I_COST.
> Here is my class function that calls the stored proc.
>
> $item_skus, $item_descriptions, $imte_quantity and $item_cost are php arrays.
>
> function do_purchase($connection, $merchant_id, $logon_name, $password, $num_items,
> $item_skus, $item_descriptions,
> $item_quantity, $item_cost, $purchase_amount, $purchase_tax,
> $purchase_discount, $purchase_total)
> {
>
> $res = -1;
> $query = "BEGIN do_purchase($merchant_id, :logon_name, :password, :num_items,
> :item_skus, :item_desc, ";
> $query .= ":item_quantity, :item_cost, :purchase_amount, :purchase_shipping,
> :purchase_tax, :purchase_discount, :purchase_total, ";
> $query .= ":transaction_id, :final_balance, :first_name, :middle_initial, :last_name,
> :address1, :address2, ";
> $query .= ":city, :state, :zipcode, :telephone, :email, ";
> $query .= ":res);";
> $query .= "END;";
>
> //echo "query= $query<br>";
> //exit();
>
> $stmt = OCIParse($connection->connection, $query);
> OCIError();
>
> OCIBindByName($stmt, ":logon_name", &$logon_name, 21);
> OCIBindByName($stmt, ":password", &$password, 21);
> OCIBindByName($stmt, ":num_items", &$num_items, 10);
> OCIBindByName($stmt, ":item_skus", &$item_skus, 32);
> OCIBindByName($stmt, ":item_desc", &$item_desc, 32);
>
> OCIBindByName($stmt, ":item_quantity", &$item_quantity, 32);
> OCIBindByName($stmt, ":item_cost", &$item_cost, 32);
> OCIBindByName($stmt, ":purchase_amount", &$purchase_amount, 32);
> OCIBindByName($stmt, ":purchase_shipping", &$purchase_shipping, 32);
> OCIBindByName($stmt, ":purchase_tax", &$purchase_tax, 32);
> OCIBindByName($stmt, ":purchase_discount", &$purchase_discount, 32);
> OCIBindByName($stmt, ":purchase_total", &$purchase_total, 32);
>
> OCIBindByName($stmt, ":transaction_id", &$this->transaction_id, 32);
> OCIBindByName($stmt, ":final_balance", &$this->final_balance, 32);
> OCIBindByName($stmt, ":first_name", &$this->first_name, 51);
> OCIBindByName($stmt, ":middle_initial", &$this->middle_initial, 11);
> OCIBindByName($stmt, ":last_name", &$this->last_name, 51);
> OCIBindByName($stmt, ":address1", &$this->address1, 101);
> OCIBindByName($stmt, ":address2", &$this->address2, 101);
>
> OCIBindByName($stmt, ":city", &$this->city, 101);
> OCIBindByName($stmt, ":state", &$this->state, 3);
> OCIBindByName($stmt, ":zipcode", &$this->zipcode, 11);
> OCIBindByName($stmt, ":telephone", &$this->telephone, 21);
> OCIBindByName($stmt, ":email", &$this->email, 51);
>
> OCIBindByName($stmt, ":res", &$res, 32);
> OCIExecute($stmt);
> OCIFreeStatement($stmt);
>
> return $res;
> }
>
> Thanks for the help
> Walt
>
> --
> PHP 4.0 Beta Mailing List <http://www.php.net/version4/>
> To unsubscribe, e-mail: php4beta-unsubscribe@lists.php.net
> For additional commands, e-mail: php4beta-help@lists.php.net
> To contact the list administrators, e-mail: php4beta-admin@lists.php.net
>
--
Thies C. Arntzen "One Big-Mac, Small Fries and a Coke!"
Digital Collections Phone +49 40 235350 Fax +49 40 23535180
Hammerbrookstr. 93 20097 Hamburg / Germany