Why is the oracle temporary table queried in php empty? $ DbOracleoci_connect (the database connection is normal, and the query is not a temporary table); $ oracleSql. & nbsp; begin & nbsp ;. & nbsp; insert & nbsp; into & nbsp; FS_TT. & nbsp; & php: Why is the oracle temporary table empty?
$ DbOracle = oci_connect ("The database connection is normal and the query is normal for non-temporary tables ");
$ OracleSql = "".
"Begin ".
"Insert into FS_TT ".
"Select *".
"From FS ".
"Where rownum <2 ;".
"End;"; // The same is true for writing SQL directly without begin $ stid = oci_parse ($ dbOracle, $ oracleSql );
$ R = oci_execute ($ stid );
Print_r ($ r );
$ OracleSql = "select * from FS_TT ";
$ Stid = oci_parse ($ dbOracle, $ oracleSql );
$ R = oci_execute ($ stid );
Print_r ($ r );
// The preceding SQL statement is executed in plsql, and the newly inserted data in the temporary table can be queried.
// But php cannot query
// Change the temporary table to the correct table, and php can query it.
// Why? I still put it in a session?
// Permission? The username and password used for my php connection are the same as those used for plsql.
While ($ row = oci_fetch_assoc ($ stid )){
Echo $ row ['name'],"
\ N ";
}
------ Solution --------------------
It may be where rownum <= 2; the query fails due to the semicolon following it.
You
$ OracleSql = "insert into FS_TT select * from FS where rownum <= 2 ";
Look