Output file spooling keep the space between the columns

DB version: 11.2.0.3 running Linux OS.

I ran the following:

SQL > spool test.txt1

SQL > @test.sql

SQL > spool off;

SQL > exit

in the test.sql file:

SET LINESIZE 500

SET PAGESIZE 500

SET FEEDBACK OFF

SET ECHO OFF

SET TRIMOUT ON

TERMOUT OFF SET

NEWPAGE SET TO NONE

COLUMN DAY FORMAT A9 HEADING 'DAY '.

COLUMN FORMAT A4 HEADING '00 00.

A4 01 FORMAT COLUMN TITLED '01 '.

COLUMN 02 FORMAT A4 HEADING "02".

COLUMN 03 FORMAT A4 HEADING "03".

04 '04' SECTION A4 FORMAT COLUMN

COLUMN 05 FORMAT A4 HEADING "05".

COLUMN 06 FORMAT A4 HEADING "06."

COLUMN 07 FORMAT A4 HEADING "07".

COLUMN FORMAT A4 HEADING '08' 08

COLUMN FORMAT A4 '09' SECTION 09

COLUMN 10 FORMAT A4 HEADING "10".

COLUMN 11 FORMAT A4 HEADING "11".

COLUMN 12 FORMAT A4 HEADING '12.

COLUMN 13 FORMAT A4 HEADING "13."

COLUMN 14 FORMAT A4 HEADING "14".

COLUMN 15 FORMAT A4 HEADING "15".

COLUMN 16 FORMAT A4 HEADING "16".

COLUMN 17 FORMAT A4 HEADING '17.

COLUMN 18 FORMAT A4 HEADING '18 '.

COLUMN 19 FORMAT A4 HEADING "19."

COLUMN 20 FORMAT A4 HEADING "20".

COLUMN 21 FORMAT A4 HEADING "21".

COLUMN 22 FORMAT A4 HEADING '22 '.

COLUMN 23 FORMAT A4 HEADING "23".

COLUMN 'TOT' FORM 99999 TITLE 'TOTAL '.

SELECT

TO_CHAR(COMPLETION_TIME,'YY-MM-DD') DAY,

TO_CHAR (SUM (DECODE (SUBSTR (TO_CHAR (COMPLETION_TIME, 'HH24'), 1, 2), '00', 1, 0)),'999 ') "00."

TO_CHAR (SUM (DECODE (SUBSTR (TO_CHAR (COMPLETION_TIME, 'HH24'), 1, 2), '01', 1, 0)),'999 ') "01."

TO_CHAR (SUM (DECODE (SUBSTR (TO_CHAR (COMPLETION_TIME, 'HH24'), 1, 2), '02', 1, 0)),'999 ') '02. "

TO_CHAR (SUM (DECODE (SUBSTR (TO_CHAR (COMPLETION_TIME, 'HH24'), 1, 2), '03', 1, 0)),'999 ') '03. "

TO_CHAR (SUM (DECODE (SUBSTR (TO_CHAR (COMPLETION_TIME, 'HH24'), 1, 2), '04', 1, 0)),'999 ') '04. "

TO_CHAR (SUM (DECODE (SUBSTR (TO_CHAR (COMPLETION_TIME, 'HH24'), 1, 2), '05', 1, 0)),'999 ') '05. "

TO_CHAR (SUM (DECODE (SUBSTR (TO_CHAR (COMPLETION_TIME, 'HH24'), 1, 2), '06', 1, 0)),'999 ') '06. "

TO_CHAR (SUM (DECODE (SUBSTR (TO_CHAR (COMPLETION_TIME, 'HH24'), 1, 2), '07', 1, 0)),'999 ') '07. "

TO_CHAR (SUM (DECODE (SUBSTR (TO_CHAR (COMPLETION_TIME, 'HH24'), 1, 2), '08', 1, 0)),'999 ') '08. "

TO_CHAR (SUM (DECODE (SUBSTR (TO_CHAR (COMPLETION_TIME, 'HH24'), 1, 2), '09', 1, 0)),'999 ') '09. "

TO_CHAR (SUM (DECODE (SUBSTR (TO_CHAR (COMPLETION_TIME, 'HH24'), 1, 2), '10', 1, 0)),'999 ') "10."

TO_CHAR (SUM (DECODE (SUBSTR (TO_CHAR (COMPLETION_TIME, 'HH24'), 1, 2), '11', 1, 0)),'999 ') "11."

TO_CHAR (SUM (DECODE (SUBSTR (TO_CHAR (COMPLETION_TIME, 'HH24'), 1, 2), '12', 1, 0)),'999 ') "12."

TO_CHAR (SUM (DECODE (SUBSTR (TO_CHAR (COMPLETION_TIME, 'HH24'), 1, 2), '13', 1, 0)),'999 ') "13."

TO_CHAR (SUM (DECODE (SUBSTR (TO_CHAR (COMPLETION_TIME, 'HH24'), 1, 2), '14', 1, 0)),'999 ') "14."

TO_CHAR (SUM (DECODE (SUBSTR (TO_CHAR (COMPLETION_TIME, 'HH24'), 1, 2), '15', 1, 0)),'999 ') "15."

TO_CHAR (SUM (DECODE (SUBSTR (TO_CHAR (COMPLETION_TIME, 'HH24'), 1, 2), '16', 1, 0)),'999 ') "16."

TO_CHAR (SUM (DECODE (SUBSTR (TO_CHAR (COMPLETION_TIME, 'HH24'), 1, 2), '17', 1, 0)),'999 ') "17."

TO_CHAR (SUM (DECODE (SUBSTR (TO_CHAR (COMPLETION_TIME, 'HH24'), 1, 2), '18', 1, 0)),'999 ') "18."

TO_CHAR (SUM (DECODE (SUBSTR (TO_CHAR (COMPLETION_TIME, 'HH24'), 1, 2), '19', 1, 0)),'999 ') "19."

TO_CHAR (SUM (DECODE (SUBSTR (TO_CHAR (COMPLETION_TIME, 'HH24'), 1, 2), '20', 1, 0)),'999 ') "20."

TO_CHAR (SUM (DECODE (SUBSTR (TO_CHAR (COMPLETION_TIME, 'HH24'), 1, 2), '21', 1, 0)),'999 ') "21."

TO_CHAR (SUM (DECODE (SUBSTR (TO_CHAR (COMPLETION_TIME, 'HH24'), 1, 2), '22', 1, 0)),'999 ') '22 ',.

TO_CHAR (SUM (DECODE (SUBSTR (TO_CHAR (COMPLETION_TIME, 'HH24'), 1, 2), '23', 1, 0)),'999 ') "23."

COUNT (1) "TOT".

V $ ARCHIVED_LOG

WHEN ARCHIVED = 'YES '.

AND TRUNC(SYSDATE-COMPLETION_TIME) < 7

GROUP OF TO_CHAR (COMPLETION_TIME, "AA-MM-DD")

ORDER BY TO_DATE (DATE, 'AA-MM-DD');

When I CAT the file in Linux (there the space between each aligned format and columns)

When I send emails (even when I copy here), it looks like in below

SQL > @test.sql

TOTAL DAYS 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23

--------- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------

14/08/18 0 0 0 0 8 8 8 11 11 13 12 18 19 22 21 21 20 20 19 20 9 9 9 9 287

14/08/19 12 9 17 7 7 7 7 8 10 9 6 12 10 20 4 11 11 10 25 17 18 18 18 16 289

14/08/20 11 11 18 7 10 8 9 9 9 9 9 14 13 19 16 16 20 19 21 20 20 12 11 7 318

14/08/21 5 20 19 10 8 8 8 11 9 9 11 12 19 12 12 12 18 4 7 25 19 16 16 17 307

14/08/22 13 11 20 8 10 7 9 10 11 13 11 13 25 15 16 15 18 19 21 19 26 20 13 10 353

14/08/23 10 8 21 10 9 10 9 7 9 8 7 9 12 8 7 5 10 7 7 9 8 15 14 8 227

14/08/24 4 10 25 11 9 6 8 7 7 7 6 8 12 7 5 7 6 6 5 7 6 7 12 6 194

14/08/25 8 7 25 8 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 50

SQL > spool off;

I need the output should be like tabluar format. Please notify

> But when I send the results by email his watch is not as expected.

It is because your email client, interprets and formats the text.

You've seen this interpreter notebook and it is shaped differently.

He must know what font is used for the text.  Courier and monospaced fonts generally spaces correctly.

Hemant K Collette

Tags: Database

Similar Questions

  • CANNOT OPEN OUTPUT FILE, CANNOT DELETE THE OUTPUT FILE

    Try to patch effect for Deskjet 722C for Windows 7.  Not able to replace the existing .dll files.  Error messages: could not open the output file, cannot delete the output file.

    Thank you for your response.  I found these solutions but still had problems.

    However, I was able to bypass Windows with a DOS command that did the trick.

    C:\Windows\System32>copy C:\temp\hpvdb720.dll C:\windows\system32\spool\drivers\x64\3

  • How to move the MSWMM files and keep the data on my computer?

    I downloaded digital film from my camera to a destination on my D drive as a file MSWMM (collections), and whenever I try to move the downloaded film (collection), it does not recognize the movie more.

    How to move the MSWMM files and keep the data on my computer?

    The mswmm file is the project file, not a video.
    Think of it as a recipe for a cake, it only tells you what to do with the ingredients, but does not include the ingredients.
    The mswmm file tells the computer to look in a certain folder to use a video or audio file.
    If you move the file, then MM knows not where is the file, then you must tell it, by right clicking on a red x on the timeline and then choose search for the file.

  • Replace the base file, but keep the fields

    Hello

    I have just created my first PDF form, really enjoyed it and the ease of it.

    I produced a sheet for a customer, and now I want to reproduce that form to another.

    I built the background in artificial intelligence, then added the fields in Acrobat. I have produced a new background, with all the elements in the same place, so how can I bind the form existing on the new background, keeping the fields they are.

    Thanks in advance,

    Steve

    You can use the feature to REPLACE the PAGES he (for example, right-click in the page thumbnails) to replace the Visual content of non-form and leave everything else alone. Be sure to have backups of the old and the new file as it is very easy to spoil it and end up with nothing useful.

  • ROBOCOPY can move files created yesterday to the target files and keep the folder tree and datetime attributes

    I want to create a script to move the files created in the day before in a file archive (and subfolders) into a new target folder daily.  For example, whenever I run the below script 10/02/2015, I would move files created on 01/10/2015 and earlier source archives files to the destination folders, with the same folder structure and datetime preserved.  This is my 1st ROBOCOPY command in the script.

    % VarSourceArchives % varTargetArchivesFolder % Robocopy / MIR / COPYALL / DCOPY:T / MOV / MINING: 1

    However, it doesn't move the files of more than 24 hours from when I run the script, rather than all the files created yesterday. Technically, he did what has been said, but not exactly I want.  It seems if you use /COPYALL switch, the switch / MINING: N compare file date & time stamp as file age exclusion, rather than just the number of exclusion of age days.

    How can I achieve my goal to move files from a specified number of days while preserving the postmark date & time of folders and files?  Are there different ROBOCOPY switches to set, or if it is complex date and the calculation of leap year?

    Thank you

    Michael J.

    Robocopy is a bit lacking in this regard. You can use the hybrid batch file below to reach your goal. Sets the attribute archive every file that was modified yesterday and it resets any other file attribute so that robocopy will only move the files of yesterday.

    off @echo
    Set Source = folder Temp D:\My
    the target folder = target value M:\My

    Set Scr="%temp%\TempVBS.vbs".
    (echo sPath = 'Source %'
    echo Set OFSO = CreateObject("Scripting.Filesystemobject"^)
    echo sYesterday = FormatDateTime (DateAdd ("d", Now (^),-1 ^), 2 ^)
    echo process feldspar
    echo Process(sP^) Sub
    ECHO for each represented in oFSO.GetFolder(sp^). Files
    FormatDateTime(oFile.DateLastModified,2^) if echo = _ sYesterday
    the echo then oFile.Attributes = 32 _
    echo oFile.Attributes = 0 Else
    Following the echo
    ECHO for each older in oFSO.GetFolder(sP^). Subfolders
    echo process oFolder.Path
    Following the echo
    echo End Sub) > Scr %
    cscript //nologo % VCC
    del % VCC
    Robocopy /a /s /mov 'Source %' 'target percent '.

  • How to connect PSD files and keep the visibility of layer object INDD

    I have a page with a number of related multi-layer PSD. These files PSD is still alive, with adjustment layers being added, being shifted and layers organized in folders, etc. Is there a way to link to these updates of PSD files without losing the visibility of the layer chosen in INDN perspective? I hope to set the object layer Options to display or hide the new layers in Photoshop, rather than having to define their brand new from scratch when a new layer is added to the PSD.

    Thank you.

    amy_h wrote:

    I guess that ID would use as the benchmark for the visibility layer name, since it's the only option we get control.

    But ID has no way of knowing you want to rely on names and positions not in the stack. Maybe one day this will change, but not soon. I'm sorry.

  • How to keep the columns of history in capital letters?

    Hello

    Is there a way to convert the columns that are marked as columns of history (ex: Created_By, Updated_By) uppercase and then store them in the database table? Once these columns are marked as history columns, Set accessor methods are not generated in the EOImpl class, and whenever a record is created or updated, the created_by and updated_by on these recordings are filled automatically by the framework using the name of securityContext so my interpretation is not bad.

    Is it possible to override this to ensure that whenever a transaction takes place, these columns are always inserted/updated on top of case?

    Thank you.

    You will need to return username converted to uppercase if the kind of story is HISTORY_CREATE_USER.

    So it should look like this:

    protected Object getHistoryContextForAttribute(AttributeDefImpl attributeDefImpl){
        if(attributeDefImpl.getHistoryKind()==AttributeDefImpl.HISTORY_CREATE_USER){
            return ADFContext.getCurrent().getSecurityContext().getUserName().toUpperCase();
        }else{
            return super.getHistoryContextForAttribute(attributeDefImpl);
        }
    }
    

    Dario

  • spool output file clarification of the rqd

    After the release of queue, I get the result like this
    04-C342|118| USD| -55522.08
    04-C342|140| USD| 247795906.12
    How can I get the output as LEFT ALIGNER AS below
    04-C342|118| USD|       -55522.08
    04-C342|140| USD|    247795906.12
    Help
    s

    Published by: oraclehema on March 19, 2012 07:35

    Published by: oraclehema on March 19, 2012 07:35

    Hello

    oraclehema wrote:
    Yes your correct.

    that column is column number (17.2)
    I will use lpad(col1,19)... ?

    Why not TO_CHAR?
    For example

    TO_CHAR (col1, '999999999999999.99')
    

    Your front end can probably format the resulrts, too, without changing the datattype.
    In SQL * more:

    COLUMN   col1  FORMAT  999999999999999.99
    
  • I need to change the size of my image file, but keep the same pixels. Possible?

    I'm trying to upload an image on a mobile advertising platform (Adfonic) with the following requirements: the dimensions of the Image 216 x 36 pixels; 3.0 KB maximum file size; GIF, JPG, PNG supported file formats. I figured out how to change the pixel size, but now my file is too large. I have Photoshop CS4 Extended & Vista.

    I changed the resolution of the file but then changes the size in pixels. What can I do?

    Thank you!

    maven123 wrote:

    I tried as a JPG & a PNG, GIF option was not available or I would have tried it too. It was originally a JPG and when I saved it as a PNG, it was a bit smaller but not enough.

    Try saving your document using "Save for Web" use jpeg and lower quality and all the metadata of the band.   Think that should generate the smallest file possible.

  • Battery - reduce output amperage, but keep the tension

    I have a camera that works at 12V and 2 amps. I would use a battery, such as a car battery and the amperage of derivation so that I have achieve the performance required by the device. Can you suggest a circuit that would achieve this?

    Thank you

    Thank you, all!

  • DPS error App Builder could not the signed output file created because the certificates may be invalid

    Hello

    I work at the school and I use indesign dps for educational material. I generated folios of apple store and googleplay market.

    I loaded it to apple, but I did not charge for android.

    My problem is to create .p12 certificate and I used step by step this documant ().html http://helpx.adobe.com/digital-publishing-suite/kb/publishing-process-android-amazon-mobil)

    I have create this certificate with Terminal Server.

    Ekran Resmi 2012-12-05 08.44.26.jpg

    I load this certificate to dps generator app and the on-screen display is here.

    screenn.jpgscreen.jpg

    My version of folios and dps is the same. I can do really I don't know, can you help me please?

    I build of Android Applications just fine on my end, it looks like a specific problem or a system account. Contact the Gold technical support.

  • How can I keep the photo files id3 tagging? (And video files?)

    Hello.

    This question is about id3 tagging files photo (and video?). Probably, it revolves around managing the media too.

    I have tif and jpg files that I took of the old and the new point and shoot cameras. What I'm trying to do, is to have jpg and tif of the originals. Make some changes and have a jpg and tif amendment. So I have 4 files for each image (2 independent is the original and 2 Edition). I want a lossy and lossless for each file.

    I've bothered to fill out somethings in the id3 tagging. When I tried some changes in batches to get the files, id3 tags was empty.

    I use Windows XP SP3 Home Edition 32-bit. I tried to use FormatFactory to an export batch. I use Corel PaintShop Photo Pro X 3 also, who gave the same results.

    In Windows XP: I right click on the file, the Properties tab, I think it's the details. In my view, title, author, subject, keywords, comments. It's the id3 tagging which not copied.

    When I right click and COPY a file, it keeps the id3 tags.

    I really think there's a way to deal with this. Anyone use? Nobody cares? Need scripts and a certain program? I don't think that I would have to pay for it. How professionals and more or less experienced people do it?

    I don't want a markup that is recognized by some programs. I can do that already, but it is too advantageous. I won't tag id3 4 times. I don't want a watermark.

    Are the methods or rules identical for Win Vista, Win7 or Win8? I have 32-bit and 64-bit Vista Home Premium, but have not tried it on there. I have to start the migration of files again. Vista is choose with id3 tagging anyway from what I tried. I keep said that Win7 is similar or the same.

    I thank you very much.

    A place to start...

    When a photo is copied... a new version of the file is created.
    During this process, some software will remove metadata
    in the file properties.

    The only insurance that I can think of would be to make a backup of the
    metadata, then restore the metadata if it is deleted.

    The following freeware has not been updated in a long time, but is
    a proven method to backup metadata.  Also the site
    suggests other alternatives.

    Exifer for Windows
    http://www.Friedemann-Schmidt.com/software/Exifer/

    Good luck...

  • How can I import a folder picture of mac to ipad and keep the subfolders as is?

    I want to import a file and KEEP the subfolders just how they are.  I don't want to re - fills to date, which is what makes the photos.  I tried to use itunes to import the folder and its subfolders.  There not just a way to drop the folder on the ipad via wifi?

    Response of old Toad

    Import the Photos and albums app records

  • How to read a file .xls to a situation identical to the sequence of the file without specifying the path?

    Hello

    I am trying to open a file .xls existing from the same location as the test sequence file. Can you TestStand search in the location of the sequence input file test file and then select the if present? Also, can we store the output file in the same place without specifying the path to the code?

    Example:

    Input.xls-> input file to the test sequence that must be read.

    Output.xls-> output file created by the test sequence.

    Test.SEQ-> the test sequence that reads Input.xls and creates Output.xls.

    If Test.seq and Input.xls are present instead of D:\Test\, the Test.seq code can be modified to pick up the Input.xls automatically without specifying the path? In addition, can Output.xls be created to D:\Test\ without specifying the path?

    Thank you

    Corinne

    Hi Isabelle,.

    Yes, this can be done. You can get the path to the current sequence file using RunState.SequenceFile.Path. Then find and remove the last '-' using the string functions to get just the path. You can then use this path to manage your files Input.xls and Output.xls.

    -Jack

  • Change the column header in the log file

    Hi people,

    I have a small program running to collect and record the data in a file.

    The log files to a CSV file correctly, but the column headers show as "Untitled".

    How to set these to something meaningful?

    Had a hunting around, but can't find the settings.

    Any help gratefully received!

    See you soon

    Duncan

    Finally managed to find a Community position covering cela.

    Check out this post fior details:

    https://decibel.NI.com/content/docs/doc-10694

Maybe you are looking for