3 Replies Latest reply on Sep 19, 2018 8:55 PM by jflack

    DBMS_OUTPUT Style Report


      I love the Report feature of SQL Developer, but sometimes I want a report that is a little more complicated than the feature can do.  Then I noticed that one of the report style options is "DBMS_OUTPUT".  Reading up on it, I see that you write HTML with DBMS_OUTPUT.PUT and DBMS_OUTPUT.PUT_LINE and it displays it.  So I wrote a little test report and tried it.


      Two problems:

      I figured I needed to do everything, but it looks like SQL Developer surrounds my report with its own

      <html><head>...</head><body><h1>A Title Derived from the Report Name</h1>now my report goes here</body></html>

      That's okay as long as I know it is going to do it, but can I turn it off?

      Even if I can't turn it off, I have my own CSS styling that I'd like it to do.  Is there a way to add my own style sheet - either by linking in a css file, or by adding a

        • 1. Re: DBMS_OUTPUT Style Report

          look at what this smart guy came up with D3


          1 person found this helpful
          • 2. Re: DBMS_OUTPUT Style Report

            What I'm understanding from reading the code you referenced is that DMann added some JavaScript to the report.  And I THINK the JavaScript (not being a JavaScript maven, myself) modifies the DOM to add the styling needed.  Is that right?  Well, that is certainly a possibility, and I may try it - though I was looking for a simpler solution.


            What I DO know is that:

            1. I actually created my test code by writing a PL/SQL Server Page, used LoadPSP to put it into the database as a stored procedure.  Running the stored procedure in SQL Developer with the OWA_OUTPUT window open (BTW, if you do much with the Web Toolkit, this is GREAT) got my HTML correct.  Then I edited the procedure, changed all calls to HTP.prn to calls to DBMS_OUTPUT.PUT, plus added a DBMS_OUTPUT.PUT_LINE('') to the end.  Then you can run it with the DBMS_OUTPUT window open.  The same HTML is output.
            2. It works to then create a SQL Developer report with the type as DBMS_OUTPUT, and the SQL Query as "BEGIN my_report_procedure; END;".
            3. But my HTML includes a <style>...</style> inside <head>...</head> which is ignored.
            • 3. Re: DBMS_OUTPUT Style Report

              I tried the technique of adding the <style>...</style> with JavaScript. When you export the report to HTML, this works pretty well, except the styles that are generated in report.css seem to override some of mine.  When you display the report inside of SQL Developer, the base HTML is used, and the script is probably not run.


              Of course, I COULD try adding the "style" attribute to my elements, instead of relying on a "class" attribute to apply my styling.  Or I could using the styling attributes like "border" on my elements - HTML 3-like.


              I'll wait a day or so to see if anyone has better suggestions, then I'll mark this as answered.