DBAsupport.com Forums - Powered by vBulletin
Results 1 to 9 of 9

Thread: Oracle To Excel Report Under Unix Environment

  1. #1
    Join Date
    Jun 2007
    Posts
    15

    Oracle To Excel Report Under Unix Environment

    Hi
    I am ruuning sql query using sql plus report commands under unix environment
    i spool the file name is report.csv
    send the report to using mailx shell script command to outlook.
    i need to create this every day.
    when i opend the excel report, my columns are merged together.
    if my dateabase columsn are name,status,date,begin,end

    when i opned the excel i can see part of the excell cells result. i mean, i need to manually the drag the each column cell to see whole column result.
    this is annoying. why it NOT formatting correct length of column result even thought i used CSV FORMAT.
    help me
    thx
    N.

    set pageset 0
    set heading off
    spool report.csv
    select name||','||status||','||date||','||begin||','||end
    from tabname
    where a.name = b.name
    orader by name;
    spool off
    using mailx command send the outlook. when i opend it is happein glike this. how to fix this problem.

    N.

  2. #2
    Join Date
    Feb 2000
    Location
    Singapore
    Posts
    1,758
    Quote Originally Posted by NIckman
    Hi
    I am ruuning sql query using sql plus report commands under unix environment
    i spool the file name is report.csv
    send the report to using mailx shell script command to outlook.
    i need to create this every day.
    when i opend the excel report, my columns are merged together.
    if my dateabase columsn are name,status,date,begin,end

    when i opned the excel i can see part of the excell cells result. i mean, i need to manually the drag the each column cell to see whole column result.
    this is annoying. why it NOT formatting correct length of column result even thought i used CSV FORMAT.
    help me
    thx
    N.

    set pageset 0
    set heading off
    spool report.csv
    select name||','||status||','||date||','||begin||','||end
    from tabname
    where a.name = b.name
    orader by name;
    spool off
    using mailx command send the outlook. when i opend it is happein glike this. how to fix this problem.

    N.
    It is something to do with MS Excel. It doesn't format csv files properly.
    Sanjay G.
    Oracle Certified Professional 8i, 9i.

    "The degree of normality in a database is inversely proportional to that of its DBA"

  3. #3
    Join Date
    Nov 2002
    Location
    Mooresville, NC
    Posts
    349
    If you have tools like toad, then it's better to use them for this purposes.
    http://www.perf-engg.com
    A performance engineering forum

  4. #4
    Join Date
    Feb 2000
    Location
    Singapore
    Posts
    1,758
    Quote Originally Posted by malay_biswal
    If you have tools like toad, then it's better to use them for this purposes.
    I do not agree. Unloading data to csv file can be easily achieved using sqlplus. Why spend $$ in Toad then?
    Sanjay G.
    Oracle Certified Professional 8i, 9i.

    "The degree of normality in a database is inversely proportional to that of its DBA"

  5. #5
    Join Date
    Jun 2007
    Posts
    15
    Sanjay,
    Thanks for your reply.
    That means even if i use csv file format, the excel does not format correctly.
    we need some thing like third party tool to fox the problem. i use oracle 9i.
    can you provide any solution to fix the problem.
    i tried with .txt extention,.prn extenstion. no luck .help me

    Thanks, N.

  6. #6
    Join Date
    Nov 2002
    Location
    Mooresville, NC
    Posts
    349
    IF you suggest him not to use any tool, i guess you will provide him the way to help him.
    http://www.perf-engg.com
    A performance engineering forum

  7. #7
    Join Date
    Jun 2005
    Location
    USA
    Posts
    57
    I am getting as it suposed to be...

    test done:

    sql> spool test.csv
    sql>select INSTANCE_NUMBER||','||INSTANCE_NAME||','||HOST_NAME||','||STATUS fro
    m v$instance;

    sql>spool off
    at the unix level issued the below command

    bash# uuencode test.csv test1.csv | mailx -s test lastname.firstname@gmail.com

    got the excel sheet as attachment with the result set in separate cells


    SQL> select INSTANCE_NUMBER||' '||INSTANCE_NAME||' '||HOST_NAME||' '||STATUS from v$instance;

    1 accdmill dbfin-prod2 OPEN

    SQL> spool off
    People with goals know where they are going

  8. #8
    Join Date
    Jun 2007
    Posts
    15
    thanks for your reply. I am getting results on each cell as it suppose to do.
    That is not my prolbem. the problem is each cell is merged together.
    i just need to drag the each cell of column to see whole column result.
    here is full code:
    i did n't understand your code. pl explain. from where to where to i need to
    use your code also. for example, but if you have name column length is 50 char, that is in cell A in excel sheet. when i opend the excel i can see first few chars like excel default width.
    like that all the columns. i need to manually drag each cell of all the columns to see whole column properly. your code is solution for that pl let me know.
    pl tell me exact code with comments i need to use.

    here my code


    set pageset 0
    set heading off
    spool report.csv
    select name||','||status||','||date||','||begin||','||end
    from tabname
    where a.name = b.name
    orader by name;
    spool off

    /usr/bin/uuencode Report.csv > attachment_report.csv

    mailx -s test lastname.firstname@gmail.com < attchment_report.csv




    Thanks,N.

    pl reply fast with correct code.
    i am desparate.

  9. #9
    Join Date
    Sep 2002
    Location
    England
    Posts
    7,334
    so its an excel problem, not an oracle one

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width