将数据保存在ORACLE数据库警告和致命错误时出错

时间:2012-10-18 13:17:49

标签: php oracle

帮助理解错误。

重点是:

  1. 包括缓冲,创建XML数据:

    ob_start();
    header("Content-Type: text/xml");
    header("Expires: Thu, 19 Feb 1998 13:24:18 GMT"); 
    header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); 
    header("Cache-Control: no-cache, must-revalidate"); 
    header("Cache-Control: post-check=0,pre-check=0"); 
    header("Cache-Control: max-age=0"); 
    header("Pragma: no-cache"); echo "<?xml version=\"1.0\" encoding=\"WINDOWS-1251\" standalone=\"yes\"?>";
        echo "<MAIN>";
        echo "<ROWSET>";
            echo "<ROW>";
                echo "<CODE>somecode</CODE>";
                echo "<DESC>somedesc</DESC>";
                echo "<NOMINAL>somenominal</NOMINAL>";
                echo "<DATE>2012.01.01</DATE>";
                echo "<TYPE>sometype</TYPE>";
            echo "</ROW>";
        echo "</ROWSET>";
    echo "</MAIN>";
    
  2. 将缓冲区的内容放入变量content,刷新缓冲区并关闭缓冲。

    $content = ob_get_contents();
    ob_end_clean();
    
  3. 连接到数据库,并调用一个函数,传递content来保存我写的代码,取自官方手册,可能不是这样。)

    error_reporting(E_ALL);
    ini_set('display_errors',1);
    header('Content-Type: text/xml; charset=windows-1251');
    $c=oci_connect("test_user", "test_schema", "DBtest");
    $rclob = oci_new_descriptor($c, OCI_D_LOB);
    $clob = oci_new_descriptor($c, OCI_D_LOB);   
    $s = oci_parse($c, "begin :ret:=create_sm.get_xml_data(:data, :out); end;");    
    oci_bind_by_name($s, ":data", $clob, -1, OCI_B_CLOB);
    oci_bind_by_name($s, ":ret", $rclob, -1, OCI_B_CLOB);
    oci_bind_by_name($s, ":out", $out, 1000);
    $clob->writeTemporary($content);
    $r = oci_execute($s, OCI_DEFAULT); // use OCI_DEFAULT so $lob->save() works
    //$e = oci_error($s);
    //var_dump($e);
    oci_commit($c);
    //echo $out;
    $returnvalues = convertDateBackwards($rclob->load());
    $returnvalues = str_replace("<SECURITY>","<SECURITY ret=\"".$out."\">",$returnvalues);
    //echo convertDateBackwards($rclob->load());
    echo $returnvalues;
    $clob->free(); // close LOB descriptor to free resources
    $rclob->free(); // close LOB descriptor to free resources
    oci_free_statement($s);
    oci_close($c);
    
  4. 此错误出现在:

    Warning: oci_execute() [function.oci-execute]: 
    ORA-06550: line 1, column 14: 
    PLS-00201: identifier 'CREATE_SM.GET_XML_DATA' must be declared 
    ORA-06550: line 1, column 7: PL / SQL: Statement ignored in C:\webserver\www.site.ru\www\blocks\create_xml.php on line 57  
    Fatal error: Call to undefined function convertDateBackwards() in C:\webserver\www.site.ru\www\blocks\create_xml.php on line 62
    

1 个答案:

答案 0 :(得分:0)

解决。最初由所有者发布作为评论,通过以下方式解决:

  

是的,就像我说的那样,问题与访问权限有关。谢谢   大家帮忙。

使用APC评论:

So, does TEST_USER own a package called CREATE_SM which has
a function called GET_XML_DATA? 
It appears not, because that is what the error message is telling you.