检索PHP/OCI中最后插入的ROWID [英] Retrieving Last Inserted ROWID In PHP/OCI

查看:71
本文介绍了检索PHP/OCI中最后插入的ROWID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在PHP中检索最后插入的Oracle行的rowid?我正在尝试:

Is it possible to retrieve the rowid of the last inserted Oracle row in PHP? I was trying:

$statement = oci_parse($conn, "INSERT INTO myTable (...) VALUES ( ...)");
$results = oci_execute($statement);
while($row = oci_fetch_assoc($statement)) {
    $rowid = $row['ROWID'];
}

没有运气.我在获取行中得到错误定义未完成,然后执行获取或执行的错误.

With no luck. I'm getting the error define not done before fetch or execute and fetch at the fetch line.

推荐答案

声明:

$var = "AAAV1vAAGAAIb4CAAC";

使用:

INSERT INTO myTable (...) VALUES ( ...)
RETURNING RowId INTO :p_val

将变量绑定到PHP变量:

Bind your variable to a PHP variable:

oci_bind_by_name($statement, ":p_val", $val, 18);

这篇关于检索PHP/OCI中最后插入的ROWID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆