今天发现使用 PHP 调用 Oracle 存储过程总是出现这样的一个错误。
ORA-01008: not all variables bound
后来折腾了很久,发现是变量名写错了。
<?php $conn = oci_connect('SCOTT','TIGER') or die;// 建立连接 if (!$conn) { $e = oci_error(); print htmlentities($e['message']); exit; } $sql = 'BEGIN pack_gt_calc.Pro_gt_Confirm(:year, :week, :errno, :errmsg); END;'; // 查询语句 $stid = oci_parse($conn, $sql); // 配置SQL语句,准备执行 if (!$stid) { $e = oci_error($conn); print htmlentities($e['message']); exit; } // Bind the input parameter oci_bind_by_name($stid,':year',$year,32); // Bind the input parameter oci_bind_by_name($stid,':week',$week,32); // Bind the output parameter oci_bind_by_name($stid,':errno',$error,32); // Bind the output parameter,变量名 ermsg 写错了 oci_bind_by_name($stid,':ermsg',$errmsg,64); // Assign a value to the input $year = '2016'; $week = '4'; $r = oci_execute($stid); // 执行SQL。OCI_DEFAULT表示不要自动commit if(!$r) { $e = oci_error($stid); echo htmlentities($e['message']); exit; } echo "errmsg is : $error<br>"; echo "errmsg is : $errmsg<br>"; oci_close($conn); ?>
参考资源:http://www.oracle.com/technetwork/cn/articles/fuecks-sps-082839-zhs.html
原文链接:http://woqilin.blogspot.com/2016/05/php-oracle-not-all-variables-bound.html
相关推荐
python-oracledb的源码和使用示例代码, python-oracledb 1.0,适用于Python versions 3.6 through 3.10. Oracle Database; This directory contains samples for python-oracledb. 1. The schemas and SQL ...
What This Book Does Not Cover Conventions Used in This Book Which Version? Resources Available at the Book's Web Site Using Code Examples Safari® Enabled How to Contact Us ...
Complex Variables and Applications
另一个办法是修改php配置文件,修改error_reporting 其值改为error_reporting = E_ALL& ~E_NOTICE。或者修改函数中的引用方式即可。 ps:修改配置文件时,最好是复制一行,注掉,然后再改,如果需要随时切回。 ...
Setting Environment Variables 2-11 Oracle Universal Installer (OUI) 2-13 Installing the Oracle Software 2-14 Database Configuration Options 2-15 iii Oracle Internal & Oracle Academy Use Only.............
Complex Variables and Applications
plex variables. The task is a bit daunting. This is one of the oldest areas in mathematics, it is beautiful and compelling, and there is a plethora of material. The literature in complex variables is ...
8、存储函数和过程 查看函数和过程的状态 SQL>select object_name,status from user_objects where object_type='FUNCTION'; SQL>select object_name,status from user_objects where object_type='PROCEDURE';...
Laravel开发-laravel-variables Laravel项目中的变量/设置管理
Calculus_of_Several_Variables.pdf
Toad and Oracle Enterprise Manager 29 Quick Search Bar 30 Additional Resources 31 Working with other Quest Products 32 Knowledge Xpert 32 Using SQL Optimizer with Toad 32 Benchmark Factory 33 Quest ...
System_Variables_en系统变量,Expert Documentation System Variables For KUKA System Software 8.1, 8.2 and 8.3
oracle知识点,踊跃共享,共享光荣 1,raise_application_error(-20005,''); 2,when no_data_found then 3 number(6,2)位数,保留小数位数 4 exec =call(包)函数 5create or replace trigger update_cascade after ...
You can redirect all of the output of your scripts to a function. For ; example, if you set output_handler to "mb_output_handler", character ; encoding will be transparently converted to the ...
Complex Variables and Applications 7ed
Makefile基础知识学习
Delphi+Codesoft 7.0 调用条码格式文件打印 现附上部分源码(附件中有一个条码格式文件,可设置3个条码,可直接从ERP系统中读取物料编码,名称和规格资料,需要 CodeSoft 7.0 支持,有问题请 email: bambuz@126.com):...
Probability, Random Variables and Stochastic Processes本书是关于概率论和随机过程的经典教材,本书是完整版的pdf,高清晰
Probability, Random Variables, and Stochastic Processes (McGraw-Hill Series in Electrical Engineering)