title: How to get DBMS_ADDM report output through PHP
body: <p>I am trying to get the ADDM report for Oracle Database. The output is in an array fashion as a .txt. I need to display it in a table row format. I'm not getting the desired output however.</p>
  
  <pre><code>  $today = date("His");
    $taskname =$username.$today;
    $taskquery = "BEGIN DBMS_ADDM.ANALYZE_INST(:tname,     :bsnap,:esnap,:instnum);END;";
    $stid = oci_parse($conn,$taskquery);
    oci_bind_by_name($stid, ":tname", $taskname);
    oci_bind_by_name($stid, ":bsnap", $bsnap);
    oci_bind_by_name($stid, ":esnap", $esnap);
    oci_bind_by_name($stid, ":instnum", $inst);
    oci_execute($stid);
    $mainquery = "SELECT DBMS_ADDM.GET_REPORT(:tname) from dual";
    $stid = oci_parse($conn,$mainquery);
      oci_bind_by_name($stid, ":tname", $taskname);
      oci_execute($stid);
      echo "&lt;table border='1'&gt;\n";
     while ($row = oci_fetch_array($stid, OCI_ASSOC+OCI_RETURN_NULLS)) {
         echo "&lt;tr&gt;\n";
        foreach ($row as $item) {
             echo "    &lt;td&gt;" . $item . "&lt;/td&gt;\n";
         }
    echo "&lt;/tr&gt;\n";
    }
    echo "&lt;/table&gt;\n";
  </code></pre>
  
  <p>Now this returns a error saying : Object of class OCI-Lob could not be converted to string</p>
  
  <p>So I tried a var_dump  after doing a oci_fetch_all on $stid, and got this:</p>
  
  <pre><code>array (size=1)
    'DBMS_ADDM.GET_REPORT(:TNAME)' =&gt; 
      array (size=1)
        0 =&gt; string '          ADDM Report for Task...and rest of the report shows here'
  </code></pre>
  
  <p>How can I echo that string that shows the report, because it displays it in the proper format I would get it on a shell. This is for a front end UI purpose.</p>