-1

Im using ORACLE to select the user that Lock a table, the query works fine, but when I try to retrieve the results, thrown me an error.

$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;

how can i retrieve the values;

Leoh
  • 642
  • 2
  • 17
  • 41

2 Answers2

0

You Should have a comma oracle_username os_user_name, like this:

$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'";
0

If you using two different tables and you are retrieving the column name, we want to tell to database which table column's we want to SELECT. For example 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;
Punitha Subramani
  • 1,467
  • 1
  • 8
  • 6