位置: 编程技术 - 正文

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)

  • 吨位是啥意思
  • 核定征收企业所得税应税所得率
  • 营业费用和管理费用比较
  • 应收票据属于其他应收账款吗
  • 滴滴行程单修改器
  • 收到发票未付款怎么处理
  • 企业投资可以税后扣除吗
  • 高速公路通行费发票可以抵扣增值税吗
  • 企业合并的相关税费计入哪里
  • 收到实收资本要交什么税
  • 某企业月末由仓库转来发料凭证汇总表
  • 开具的增值税发票丢失最新处理办法
  • 个体工商户转为企业要交税吗
  • 未开票增值税怎么申报
  • 罚款费用报销单怎么写
  • 政府补贴是否可享受即征即退优惠政策
  • 一般空调安装费多少钱
  • 暂时关闭朋友圈
  • 其他资金结转结余包括哪些
  • 股东之间转让股权需要股东会决议吗
  • php递归函数详解
  • php常用的优化方式
  • 税务局返还税款账务处理
  • 默认网关和dns怎么填
  • win11启动方式
  • 入库前仓储费用应计入
  • php字符串型数据的定义方式
  • php数组函数输出《咏雪》里有多少"片"字
  • 在建工程进项税可以抵扣吗
  • 房地产企业前期物业费可否税前扣除
  • php that
  • PHP:iconv_strrpos()的用法_iconv函数
  • 通过二手车买进套现
  • 异地成立分公司的流程和要求
  • 高新技术企业如何在电子税务局备案
  • yolov5模型中git的作用
  • 境外服务费代扣代缴所得税
  • react router教程
  • 怎么把html转成图片
  • SpringBoot+Vue实现简单用户管理平台第一篇(后端接口设计)
  • 开源原则
  • bulkload命令
  • 应付职工薪酬住房公积金怎么算
  • 在建工程盘盈盘亏的账务处理
  • 公司个人所得税申报操作流程
  • 办理进出口权的费用西安
  • sql server 附加
  • 企业所得税税款可以税前扣除吗
  • 收到单位借款如何入账
  • 发票当月没开
  • 办公室装修费计入长期待摊费用
  • 销售费用的增值税是进项还是销项
  • 转让股权需要缴纳哪些税
  • 当月预交增值税时所属期选了上期怎么办
  • 坏账准备转回并收到货款会计分录
  • 支付给烟农的价格怎么算
  • 应收账款和应付账款属于什么科目
  • 资产处置损失抵税
  • 公司员工餐费如何做账
  • 税金及附加是什么账户
  • 盈余公积金计算方法
  • 会计借方和贷方有哪些科目
  • sql server储存过程的创建与使用
  • win10免费安装吗
  • windows主进程rundll32总是用麦克风
  • 移动硬盘中安装系统
  • linux缺省的shell
  • kochsysteme
  • 迅雷看看电脑版 下载
  • windows10 14393版本
  • win7系统安装office2019
  • win7系统出现COMSurrogate
  • JavaScript打开WPS
  • jquery?
  • 汉诺塔游戏教程
  • 安卓动态图标怎么实现
  • bootstraptable方法
  • 屏幕模式自适应模式
  • android studio 安装好后怎么在桌面找到
  • 税务罚款会影响宝宝当公务员不
  • 免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

    鄂ICP备2023003026号

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

    友情链接: 武汉网站建设