Why is php empty when querying the temporary oracle table?

Source: Internet
Author: User
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.