位置: 编程技术 - 正文

PHP:oci_execute()的用法_Oracle函数(php oci_connect)

编辑:rootadmin
oci_execute

推荐整理分享PHP:oci_execute()的用法_Oracle函数(php oci_connect),希望有所帮助,仅作参考,欢迎阅读内容。

文章相关热门搜索词:php_eof,php oci8,php opache,php-eol,php oci8,php oci,php occ,php oci8,内容如对您有帮助,希望把文章链接给更多的朋友!

(PHP 5, PECL OCI8 >= 1.1.0)

oci_execute — 执行一条语句

说明 bool oci_execute ( resource $stmt [, int $mode ] )

oci_execute() 执行一条之前被解析过的语句(见 oci_parse())。可选参数 mode 允许定义执行模式(默认是 OCI_COMMIT_ON_SUCCESS)。如果不需要将语句自动提交,则需要把 mode 设为 OCI_DEFAULT。

用 OCI_DEFAULT 模式时,将建立一个事务。事务会在关闭连接或脚本结束时(看哪个先)自动回卷。需要明确调用 oci_commit() 来提交事务,或者 oci_rollback() 中止事务。

成功时返回 TRUE, 或者在失败时返回 FALSE。

Note:

在 PHP 5.0.0 之前的版本必须使用 ociexecute() 替代本函数。该函数名仍然可用,为向下兼容作为 oci_execute() 的别名。不过其已被废弃,不推荐使用。

参数

statement

A valid OCI statement identifier.

mode

An optional second parameter can be one of the following constants: Execution Modes Constant Description OCI_COMMIT_ON_SUCCESS Automatically commit all outstanding changes for this connection when the statement has succeeded. This is the default. OCI_DEFAULT Obsolete as of PHP 5.3.2 (PECL OCI8 1.4) but still available for backward compatibility. Use the equivalent OCI_NO_AUTO_COMMIT in new code. OCI_DESCRIBE_ONLY Make query meta data available to functions like oci_field_name() but do not create a result set. Any subsequent fetch call such as oci_fetch_array() will fail. OCI_NO_AUTO_COMMIT Do not automatically commit changes. Prior to PHP 5.3.2 (PECL OCI8 1.4) use OCI_DEFAULT which is an alias for OCI_NO_AUTO_COMMIT.

Using OCI_NO_AUTO_COMMIT mode starts a transaction. Transactions are automatically rolled back when the connection is closed, or when the script ends. Explicitly call oci_commit() to commit a transaction, or oci_rollback() to abort it.

When inserting or updating data, using transactions is recommended for relational data consistency and for performance reasons.

If OCI_NO_AUTO_COMMIT mode is used for any statement including queries, and oci_commit() or oci_rollback() is not subsequently called, then OCI8 will perform a rollback at the end of the script even if no data was changed. To avoid an unnecessary rollback, many scripts do not use OCI_NO_AUTO_COMMIT mode for queries or PL/SQL. Be careful to ensure the appropriate transactional consistency for the application when using oci_execute() with different modes in the same script.

返回值

成功时返回 TRUE, 或者在失败时返回 FALSE。

范例

Example #1 oci_execute() for queries

<?php$conn=oci_connect('hr','welcome','localhost/XE');$stid=oci_parse($conn,'SELECT*FROMemployees');oci_execute($stid);echo"<tableborder='1'>n";while($row=oci_fetch_array($stid,OCI_ASSOC+OCI_RETURN_NULLS)){echo"<tr>n";foreach($rowas$item){echo"<td>".($item!==null?htmlentities($item,ENT_QUOTES):"&nbsp;")."</td>n";}echo"</tr>n";}echo"</table>n";?>

PHP:oci_execute()的用法_Oracle函数(php oci_connect)

Example #2 oci_execute() without specifying a mode example

<?php//Beforerunning,

Example #3 oci_execute() with OCI_NO_AUTO_COMMIT example

<?php//Beforerunning,

Example #4 oci_execute() with different commit modes example

<?php//Beforerunning,

Example #5 oci_execute() with OCI_DESCRIBE_ONLY example

<?php$conn=oci_connect('hr','welcome','localhost/XE');$stid=oci_parse($conn,'SELECT*FROMlocations');oci_execute($s,OCI_DESCRIBE_ONLY);for($i=1;$i<=oci_num_fields($stid);++$i){echooci_field_name($stid,$i)."<br>n";}?>

注释

Note:

Transactions are automatically rolled back when connections are closed, or when the script ends, whichever is soonest. Explicitly call oci_commit() to commit a transaction.

Any call to oci_execute() that uses OCI_COMMIT_ON_SUCCESS mode explicitly or by default will commit any previous uncommitted transaction.

Any Oracle DDL statement such as CREATE or DROP will automatically commit any uncommitted transaction.

Note:

Because the oci_execute() function generally sends the statement to the database, oci_execute() can identify some statement syntax errors that the lightweight, local oci_parse() function does not.

Note:

In PHP versions before 5.0.0 use ociexecute() instead. 在当前版本中,旧的函数名还可以被使用,但已经被废弃并不建议使用。

参见

oci_parse() - 配置 Oracle 语句预备执行

PHP:oci_error()的用法_Oracle函数 oci_error(PHP5,PECLOCI8=1.1.0)oci_error返回上一个错误说明arrayoci_error([resource$source])对于大多数错误,参数是最适合的资源句柄。对于oci_connect(),oci_new_connect()

PHP:oci_bind_by_name()的用法_Oracle函数 oci_bind_by_name(PHP5,PECLOCI8=1.1.0)oci_bind_by_name绑定一个PHP变量到一个Oracle位置标志符说明booloci_bind_by_name(resource$stmt,string$ph_name,mixed&$variable[,int$maxlength[,int$type

PHP:oci_define_by_name()的用法_Oracle函数 oci_define_by_name(PHP5,PECLOCI8=1.1.0)oci_define_by_name在SELECT中使用PHP变量作为定义的步骤说明booloci_define_by_name(resource$statement,string$column_name,mixed&$variable[,int$type])o

标签: php oci_connect

本文链接地址:https://www.jiuchutong.com/biancheng/281118.html 转载请保留说明!

上一篇:PHP:oci_fetch_all()的用法_Oracle函数

下一篇:PHP:oci_error()的用法_Oracle函数(php or)

  • 合并报表是把资产负债表相加吗
  • 出租车发票可以重新打印吗
  • 微信支付属于现金嘛
  • 固定资产原值包含进项税吗
  • 备用金现金日记账表格
  • 小规模建筑公司预缴增值税
  • 来料加工账务处理方法
  • 冲以前年度暂估
  • 免抵退税额账务处理流程
  • 货物运输时发生车祸
  • 单位自有车辆
  • 视同销售可以抵扣销项税吗?
  • 补计提去年的增值税
  • 独资企业个人所得税汇算清缴
  • 没有道路许可证可上营运吗
  • 非货币性资产交换准则
  • 银行开户存入的钱怎么取
  • 联营和合营的区别共同控制
  • 视同销售如何纳税调整?
  • 在建工程抵工程款
  • 留抵退还增值税
  • 公司之间借款收据要领导签字吗
  • 企业没有进项票只有成本票
  • 诉讼费做账科目
  • 增值税减免税明细表
  • 1697510614
  • 上月留底的进项税额本月转出做什么分录
  • 公司产品因质量问题买家追究
  • 华为鸿蒙怎么看手机型号
  • 发生额对照表
  • 筹备期废品回收会计分录
  • 临时股东大会的召开情形
  • 初级证书多长时间可以领取?
  • window102020年最新版本
  • php中apache的配置
  • 如何在Windows 11上卸载更新
  • win10系统如何更改工作组
  • 公司雇用临时工人工资需要到税务局开发票吗
  • 公益性捐赠支出的标准
  • 不动产出租要交什么税
  • 备用金会涨额度吗
  • etc通行费发票可以抵扣吗
  • php连接数据库mysql做登录页
  • react 组件化
  • 销售费用工资明细科目
  • 增值税申报流程大全(附图文详解)
  • 差旅费补贴要交个人所得税文件
  • 企业境外收入境内申报
  • mysql有输入输出语句
  • 无法支付款项是否缴纳增值税
  • 购买的车位是否要交税
  • 未开票收入怎么申报增值税
  • 被投资单位信息是什么
  • 小规模纳税人购买原材料会计分录
  • 关税征收方式
  • 员工奖励账务处理流程
  • 有什么科目需要考试吗英语翻译
  • 加油费不征税发票可以报销吗
  • 小规模纳税人能抵扣进项税额吗
  • 发票已开的情况下不确认收入可以吗?
  • 数据库访问机制
  • u盘安装win7系统鼠标键盘没反应
  • 为什么windows手机失败了
  • win10预览版选哪个
  • 超级管理员不能用winhello
  • win8系统怎么安装软件
  • win7软件界面显示不全怎么办
  • linux tar -czvf
  • 你将会收藏
  • android item属性
  • Android java.lang.IllegalArgumentException: pointerIndex out of range
  • JavaScript基础语法详解
  • javascript面向对象 第三方类库
  • android局部界面切换
  • js实现无限循环
  • python自动翻译小工具
  • 河北网上税务登记流程
  • 代理记账公司自查自纠情况报告范文
  • 个人限购
  • 重大税务案件审理办法51号令
  • 免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

    鄂ICP备2023003026号

    网站地图: 企业信息 工商信息 财税知识 网络常识 编程技术

    友情链接: 武汉网站建设