5 Replies Latest reply on Oct 9, 2015 9:04 PM by thatJeffSmith-Oracle

    generate command line report but only a single file

    user8909560

      hello,

      I want to generate a command line report in sqldeveloper but I'm getting the html file + a folder with the jpeg, css and gif files.

      this is my command:

       

      sdcli.exe reports generate -report test -db MYDB -file "C:\Users\myuser\Desktop\test.html"

       

      Is there a way to generate only a single file with the report but without the folder? It's not very useful to have this folder there along with my reports.

      Thanks.

        • 1. Re: generate command line report but only a single file
          user8909560

          please anyone? I want to generate a single report file (txt or html) from the command line in order to retrieve data from several databases, like this:

           

          sdcli.exe reports generate -report test -db MYDB1 -file "C:\Users\myuser\Desktop\test1.html"

          sdcli.exe reports generate -report test -db MYDB2 -file "C:\Users\myuser\Desktop\test2.html"

          sdcli.exe reports generate -report test -db MYDB3 -file "C:\Users\myuser\Desktop\test3.html"


          Can this be done?

           

          Thanks.

          • 2. Re: generate command line report but only a single file
            thatJeffSmith-Oracle

            use SQLcl, and run your queries with the HTML sqlformat

             

            set sqlformat html

             

            spool c:\users\myuser\Desktop\test1.html

             

            select ...

             

            spool off

             

            Same as you'd do in SQL*Plus, but you have access to the query output formatters in SQLcl

            • 3. Re: generate command line report but only a single file
              user8909560

              thanks jeff, but I want to reuse all the connections + password from the sqldeveloper.

              I just want to generate a simple plain report for every database in my connections from the command line. Could it be to a txt file?

              • 4. Re: generate command line report but only a single file
                user8909560

                Ok, I found a workaround.

                 

                I created a report (script) and send the output to txt file, tagging the file with the date and the instance_name;

                 

                set linesize 150

                column vpath new_value new_vpath

                column dt new_value new_dt

                column ext new_value new_ext

                column inst new_value new_inst

                select 'C:\Temp\' vpath,to_char(sysdate,'YYYYMMDD_') dt, instance_name inst,'.txt' ext from v$instance;

                spool &new_vpath&new_dt&new_inst&new_ext

                select * from dual;  --here goes your query

                spool off

                 

                And then execute the report from the command line for several databases:

                 

                sdcli.exe reports generate -report test -db DB1 -file "C:\Temp\test.html"

                sdcli.exe reports generate -report test -db DB2 -file "C:\Temp\test.html"

                sdcli.exe reports generate -report test -db DB3 -file "C:\Temp\test.html"

                 

                You'll have your report in the text file and the html file can be ignored.

                 

                Note: I tried to do the same thing using 'set sqlformat html' and send the output to an html file, but for some reason the output had several rows missing.

                • 5. Re: generate command line report but only a single file
                  thatJeffSmith-Oracle

                  before sqlcl, we had no way to command-line run queries - just reports

                   

                  >>Note: I tried to do the same thing using 'set sqlformat html' and send the output to an html file, but for some reason the output had several rows missing.

                  if you want to investigate this, please start a new thread and provide an example