SQL Statement
| From: | èdy kurniawan | Date: | Wed, 19 Jun 2002 05:59:55 +0000 |
| Subject: | SQL Statement | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-102871@lists.php.net to get a copy of this message | ||
Hello PHP mania,
I'm a newcomer right here, i just wanna ask a litle dummy question :
I put the SQL below into my SQL Plus editor :
**************************
Select OSUSER
From v$session
Where USERNAME = (Select USER From DUAL)
And AUDSID =(Select USERENV('SESSIONID') From DUAL)
*****************************
and it works with the output is my logon OS.
when I's connecting with PHP and ORACLE.DLL with the complete script below :
*****************************
<?php
PutEnv("ORACLE_SID=ORASID");
Putenv("ORACLE_HOME=c:\ORANT");
$connection = Ora_Logon ("blabla/blablabla@dbname","");
if ($connection == false){
echo Ora_ErrorCode($connection).": ".Ora_Error($connection)."<BR>";
exit;
}
$cursor = Ora_Open ($connection);
if ($cursor == false){
echo Ora_ErrorCode($connection).": ".Ora_Error($connection)."<BR>";
exit;
}
#check admin
$query = "Select OSUSER
From v$session
Where USERNAME = (Select USER From DUAL)
And AUDSID =(Select USERENV('SESSIONID') From DUAL) ";
$result = Ora_Parse ($cursor, $query);
if ($result == false){
echo Ora_ErrorCode($cursor).": ".Ora_Error($cursor)."<BR>";
exit;
}
$result = Ora_Exec ($cursor);
if ($result == false){
echo Ora_ErrorCode($cursor).": ".Ora_Error($cursor)."<BR>";
exit;
}
while (Ora_Fetch_Into ($cursor, &$values)){
$admin = $values[0];
}
echo "<H2> USER Anda sekarang : $admin";
Ora_Close ($cursor);
Ora_Logoff ($connection);
?>
***************************
the error occured :
Warning: Ora_Parse failed (ORA-00942: table or view does not exist -- while
processing OCI function OPARSE) in c:\phpdev\www\project\test\osuser.php on
line 22
942: ORA-00942: table or view does not exist -- while processing OCI
function OPARSE
why its happen ?
in the right rule of oracle, if this table or view does not exist
(V$SESSION) my SQL will not work in SQL Plus editor.
Please, help me ASAP...
TIA,
edyk