我使用ORACLE选择锁定表的用户,查询工作正常,但是当我尝试检索结果时,抛出错误。
$c = ' SELECT oracle_username os_user_name, locked_mode, object_name, object_type FROM V$LOCKED_OBJECT lo,DBA_OBJECTS do'." WHERE lo.object_id = do.object_id AND do.object_name='CLIENTS'";
$s = oci_parse($conn_s, $c );
oci_execute($s);
while($res = oci_fetch_array($s, OCI_ASSOC+OCI_RETURN_NULLS)){
//var_dump($res);
$check = $res['OS_USER_NAME'];
}
echo $check;
我该如何检索这些值;
答案 0 :(得分:1)
您应该这样一个逗号oracle_username os_user_name,
:
$c = ' SELECT oracle_username, os_user_name, locked_mode, object_name, object_type FROM V$LOCKED_OBJECT lo,DBA_OBJECTS do'." WHERE lo.object_id = do.object_id AND do.object_name='CLIENTS'";
答案 1 :(得分:0)
如果您使用两个不同的表并且要检索列名,我们想告诉数据库我们要选择哪个表列。例如lo.oracle_username,do.os_user_name。
$c = "SELECT oracle_username, os_user_name, locked_mode, object_name, object_type FROM V$LOCKED_OBJECT lo,DBA_OBJECTS do WHERE lo.object_id = do.object_id AND do.object_name='CLIENTS'";
$s = oci_parse($conn_s, $c );
$res = oci_execute($s);
while($res = oci_fetch_array($s, OCI_ASSOC+OCI_RETURN_NULLS)){
//var_dump($res);
$check = $res['OS_USER_NAME'];
}
echo $check;