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 -s ${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 -s " 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