Sponsored Content
Top Forums Shell Programming and Scripting store the table data in excel file Post 302292351 by govindts on Friday 27th of February 2009 04:05:15 PM
Old 02-27-2009
store the table data in excel file

Hello -

I have a below table and i want to extract the data into excel sheet and send to different location.

Here is the table structure...

SQL> desc t_i1_exportdocs
Name Null? Type
----------------------------------------- -------- -----------------
Delivery # VARCHAR2(50)
REGION VARCHAR2(50)
Proforma Invoice VARCHAR2(50)
SONUM VARCHAR2(50)
Export Docs print date VARCHAR2(50)
Export Docs print time VARCHAR2(50)
SLD2NAME VARCHAR2(50)
Freight Fwdr (name) VARCHAR2(50)
Shipto Ctry VARCHAR2(50)
Shipping Point VARCHAR2(50)
Extract Date VARCHAR2(50)

SQL>

Here is the code i am using shell script. But the excel file content is not in correct order..

Each record is not in the same line in excel sheet... How can i display the entire record in the same in excel sheet?

PHP Code:
${ORACLE_HOME}/bin/sqlplus -${ORA_USER}/${ORA_PASSW}@${ORACLE_SID} << EOF > ${FTP_TO}/T_i1_exportdocs_b.csv

set pages 0
set 
echo off
set ver off
set feed off

SELECT
'Delivery #'||','||'REGION'||','||'Proforma Invoice'||','||'SONUM'||','||'Export Docs print date'||','||'Export Docs print time'||','||'SLD2NAME'||','||'Frei
ght Fwdr (name)'
||','||'Shipto Ctry'||','||'Shipping Point'||','||'Extract Date' from dual;

select
"Delivery #"||','||
REGION||','||
"Proforma Invoice"||','||
SONUM||','||
"Export Docs print date"||','||
"Export Docs print time"||','||
SLD2NAME||','||
"Freight Fwdr (name)"||','||
"Shipto Ctry"||','||
"Shipping Point"||','||
"Extract Date"
FROM xyz;

exit;
EOF

uuencode 
${FTP_TO}/T_i1_exportdocs_b.csv ${FTP_TO}/T_i1_exportdocs_b.csv mailx -" excel data for t_i1_exportdocs B box" xx@comp.com 

Here is the excel file content...


PHP Code:
Delivery #    REGION    Proforma Invoice    SONUM    Export Docs print date    Export Docs prin        
t time    SLD2NAME    Freight Fwdr (name)    Shipto Ctry    Shipping Point    Extract Date        
                            
99572613    EMEA    2900000263    11297854    2
/26/2009    16:37:42     Int'l Sales Ltd.    
    UPS  SOLUTIONS    DE    CF3N    2/27/2009            
                            
99568129    CALA    2900001376    11317104    2/26/2009    13:04:01    TALLARD TECHNOLOGIES I    
NCORPORATED    CONTINENTAL FREIGHT FORWARDING INC    US    CF3N    2/27/2009            
                            
99570027    CALA    2900001377    11317104    2/26/2009    13:04:15    TALLARD TECHNOLOGIES I    
NCORPORATED    CONTINENTAL FREIGHT FORWARDING INC    US    CF3N    2/27/2009 
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to store Data in a File

I want to read a data from a read command and store it in a file...... Plz send me how I can do that Ex: read val and I want to store this val in a file called temp. (2 Replies)
Discussion started by: krishna_sicsr
2 Replies

2. Shell Programming and Scripting

Help on email data file as excel from unix!!

Hi, I need to email a data in excel sheet from unix using shell scripting.I could able to generate the data file with tab delimiter with extension .xls could able to email it. The problem is when a coulmn with 16 digit number is exported, it is showing in scientific format. Any help in... (1 Reply)
Discussion started by: sparan_peddu
1 Replies

3. Shell Programming and Scripting

how to copy data to to excel file

Hi, Can any one tell me how to copy data using shell script to a excel file from text file to other columns of excel file,leaving first column unaffected i.e it should not overwrite data in first column. Say my text file data is: 15-dec-2008 15-dec-2009 16-dec-2008 16-dec-2009 ... (7 Replies)
Discussion started by: tucs_123
7 Replies

4. UNIX for Dummies Questions & Answers

How to store the flat file in an excel sheet

Hi, I need to automate a script. The process in the script is as follows Running the script abc.ksh The report is stored in xyz (flat file) Need to store the flat file content in an excel sheet. Your reply is highly appreciated. Thanks, Karthick (2 Replies)
Discussion started by: karthickrn
2 Replies

5. Shell Programming and Scripting

Copying data from excel file

Hii friends, I am a newbie to unix/shell scripting and got stuck in implementing a functionality.Dear experts,kindly spare some time to bring me out of dark pit :confused:.. My requirement is somewhat wierd,let me explain what i have and what i need to do... 1) there are several excel... (1 Reply)
Discussion started by: 5ahen
1 Replies

6. Shell Programming and Scripting

Sample ksh script for copy the data from excel to database table ?

Hi All, I need to convert the data from excel to database table in sybase. Please provide some sample script.. thanks, Royal. (1 Reply)
Discussion started by: royal9482
1 Replies

7. Shell Programming and Scripting

Store data from dynamic website table

hi everybody, Asking for something that I´m not sure if it´s possible to implement. I hope be clear enough. Well, my issue is that I´m looking how to copy or extract a particular table content of a website. I get the content from a external feed (Iframe format), the content is updated every... (1 Reply)
Discussion started by: cgkmal
1 Replies

8. Shell Programming and Scripting

Store table contents in csv file

I need to write a script to store the contents of a table in a csv file I'm using Toad, it's a Oracle database. (5 Replies)
Discussion started by: ladyAnne
5 Replies

9. Shell Programming and Scripting

Script to generate Excel file or to SQL output data to Excel format/tabular format

Hi , i am generating some data by firing sql query with connecting to the database by my solaris box. The below one should be the header line of my excel ,here its coming in separate row. TO_CHAR(C. CURR_EMP_NO ---------- --------------- LST_NM... (6 Replies)
Discussion started by: dani1234
6 Replies

10. Shell Programming and Scripting

Formatting data to put it in the excel file

Hello, I have a file with the below contents : Policy Name: Backup_bkp Policy Type: Catalog_bkp Active: yes Effective date: 08/07/2013 02:02:12 Mult. Data Streams: no Client Encrypt: no Checkpoint: no Policy Priority: ... (11 Replies)
Discussion started by: rahul2662
11 Replies
All times are GMT -4. The time now is 09:17 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy