位置: 编程技术 - 正文

PHP:oci_bind_array_by_name()的用法_Oracle函数

编辑:rootadmin
oci_bind_array_by_name

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

文章相关热门搜索词:,内容如对您有帮助,希望把文章链接给更多的朋友!

(PHP 5 >= 5.1.2, PECL OCI8 >= 1.2.0)

oci_bind_array_by_name — Binds a PHP array to an Oracle PL/SQL array parameter

说明 bool oci_bind_array_by_name ( resource $statement , string $name , array &$var_array , int $max_table_length [, int $max_item_length = -1 [, int $type = SQLT_AFC ]] )

Binds the PHP array var_array to the Oracle placeholder name, which points to an Oracle PL/SQL array. Whether it will be used for input or output will be determined at run-time.

参数

statement

A valid OCI statement identifier.

name

The Oracle placeholder.

var_array

An array.

max_table_length

Sets the maximum length both for incoming and result arrays.

max_item_length

Sets maximum length for array items. If not specified or equals to -1, oci_bind_array_by_name() will find the longest element in the incoming array and will use it as the maximum length.

type

Should be used to set the type of PL/SQL array items. See list of available types below:

PHP:oci_bind_array_by_name()的用法_Oracle函数

SQLT_NUM - for arrays of NUMBER.

SQLT_INT - for arrays of INTEGER (Note: INTEGER it is actually a synonym for NUMBER(), but SQLT_NUM type won&#;t work in this case even though they are synonyms).

SQLT_FLT - for arrays of FLOAT.

SQLT_AFC - for arrays of CHAR.

SQLT_CHR - for arrays of VARCHAR2.

SQLT_VCS - for arrays of VARCHAR.

SQLT_AVC - for arrays of CHARZ.

SQLT_STR - for arrays of STRING.

SQLT_LVC - for arrays of LONG VARCHAR.

SQLT_ODT - for arrays of DATE.

返回值

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

范例

Example #1 oci_bind_array_by_name() example

<?php$conn=oci_connect("hr","hrpwd","localhost/XE");if(!$conn){$m=oci_error();trigger_error(htmlentities($m['message']),E_USER_ERROR);}$create="CREATETABLEbind_example(nameVARCHAR())";$stid=oci_parse($conn,$create);oci_execute($stid);$create_pkg="CREATEORREPLACEPACKAGEARRAYBINDPKG1ASTYPEARRTYPEISTABLEOFVARCHAR()INDEXBYBINARY_INTEGER;PROCEDUREiobind(c1INOUTARRTYPE);ENDARRAYBINDPKG1;";$stid=oci_parse($conn,$create_pkg);oci_execute($stid);$create_pkg_body="CREATEORREPLACEPACKAGEBODYARRAYBINDPKG1ASCURSORCURISSELECTnameFROMbind_example;PROCEDUREiobind(c1INOUTARRTYPE)ISBEGIN--BulkInsertFORALLiININDICESOFc1INSERTINTObind_exampleVALUES(c1(i));--FetchandreverseIFNOTCUR%ISOPENTHENOPENCUR;ENDIF;FORiINREVERSE1..5LOOPFETCHCURINTOc1(i);IFCUR%NOTFOUNDTHENCLOSECUR;EXIT;ENDIF;ENDLOOP;ENDiobind;ENDARRAYBINDPKG1;";$stid=oci_parse($conn,$create_pkg_body);oci_execute($stid);$stid=oci_parse($conn,"BEGINarraybindpkg1.iobind(:c1);END;");$array=array("one","two","three","four","five");oci_bind_array_by_name($stid,":c1",$array,5,-1,SQLT_CHR);oci_execute($stid);var_dump($array);?>

PHP:pg_untrace()的用法_PostgreSQL函数 pg_untrace(PHP4=4.0.1,PHP5)pg_untrace关闭PostgreSQL连接的追踪功能说明boolpg_untrace([resource$connection])停止由pg_trace()启动的追踪功能。connection指定了被追踪的连接号

PHP:pg_version()的用法_PostgreSQL函数 pg_version(PHP5)pg_versionReturnsanarraywithclient,protocolandserverversion(whenavailable)说明arraypg_version([resource$connection])pg_version()returnsanarraywiththeclient,protocolandserverversion.P

PHP:pg_update()的用法_PostgreSQL函数 pg_update(PHP4=4.3.0,PHP5)pg_update更新表说明mixedpg_update(resource$connection,string$table_name,array$data,array$condition[,int$options=PGSQL_DML_EXEC])pg_update()用condition作为条件查询

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

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

下一篇:PHP:pg_untrace()的用法_PostgreSQL函数

免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

鄂ICP备2023003026号

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

友情链接: 武汉网站建设 电脑维修 湖南楚通运网络