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

解决方案 »

  1.   


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

  2.   

    实在不好意思,少复制的一行,是真的,真执行了返回值,我都打印了 print_r($r); 都是1
    现在关键是,非临时表,下面执行完后,就能查询出来,是真的,反复测试了很多很多次$oracleSql="".
    "begin ".
    " insert into FS_TT".
    " select * ".
    " from FS ".
    " where rownum <=2;".
    " end;";$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);
    while ($row = oci_fetch_assoc($stid)){
    echo $row['NAME'],"<br>\n";
    }