Home >Backend Development >PHP Tutorial >php查询oracle 临时表,为何为空

php查询oracle 临时表,为何为空

WBOY
WBOYOriginal
2016-06-13 11:45:501136browse

php查询oracle 临时表,为什么为空?

<br />$dbOracle=oci_connect("数据库连接都是正常的,查询不是临时表都正常");<br /><br />$oracleSql="". <br />"begin ". <br />"    insert into FS_TT". <br />"    select * ". <br />"    from FS ". <br />"    where rownum <2;". <br />" end;";//不用begin 直接写sql也是一样的   $stid = oci_parse($dbOracle, $oracleSql);<br /><br /> $r=oci_execute($stid);<br /> print_r($r);<br /><br /> $oracleSql="select * from FS_TT";<br /> $stid = oci_parse($dbOracle, $oracleSql);<br /> $r=oci_execute($stid);<br /> print_r($r);<br />   //上面sql在plsql里面执行都没有问题,能查询出 临时表新插入的数据 <br />   //但是php就查询不出来 <br />   //把临时表,改成正是表,php就可以查询出来 <br />   //什么原因呢?我现在还算是在一个会话里面把? <br />   //权限?我php连接用的用户名密码,和plsql用的一样   <br /><br /> while ($row = oci_fetch_assoc($stid)){     <br />	echo $row['NAME'],"<br>\n";<br /> }  <br /><br />

------解决方案--------------------
可能是  where rownum ; 后面的分号导致的查询失败


$oracleSql = "insert into FS_TT select * from FS where rownum 看看

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn