位置: 编程技术 - 正文
推荐整理分享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.
nameThe Oracle placeholder.
var_arrayAn array.
max_table_lengthSets the maximum length both for incoming and result arrays.
max_item_lengthSets 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.
typeShould be used to set the type of PL/SQL array items. See list of available types below:
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 wont 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作为条件查询
标签: PHP:oci_bind_array_by_name()的用法_Oracle函数
本文链接地址:https://www.jiuchutong.com/biancheng/281124.html 转载请保留说明!友情链接: 武汉网站建设