2009-07-30 22 views
1

sqlplusで以下のパラメータを設定してUnixボックスに表示しますが、2つのレコード間に1行のギャップが表示されます。 2つのレコードEx-Oracle - 正しい形式で出力されていません

set feedback off 
SET NEWPAGE NONE 
set HEADING Off 
set pagesize 0 
set linesize 125 
SET TRIMSPOOL ON 
set termout off 
spool /export/home/43276826/Rep_Tran_oracle_$DATE_FILE.txt 
select RecordID||','||C_S||','||P_R||','||AccountingDate||','||SettlementDate||','||Sec 
Description||','||ISIN||','||MessageRef||','||Amount||','||Department||','||AssignedTo||','||LastUpdate||','||CashAmount||',' 
||CashAmountUSD||','||LastNoteText||','||LastNoteUser||','||CashCurrency||','||BIMASNumber||','||RelatedReference||','||Sende 
rToRec||','||OpType||','||OriginalISIN from HSBC_ALL_OI_T; 

201280,C,R,21.4.2009,21.4.2009,"HSBC HLDG","GB0005405286","00001/20090421-1006851",188.00 
0000,"TITBB/F"," ",22.4.2009,0.00,,"NOTHING GENEVA","ADK"," ","GB411161","SF-0357690"," ","FR"," " 

"201279,C,P,21.4.2009,21.4.2009,"HSBC HLDG","GB0005405286","00001/20090421-1401548",188.00 
0000,"TITBB/F"," ",22.4.2009,0.00,,"NOTHING GENEVA","ADK"," ","GB411161","SF-0357689"," ","FD"," " 

there is a gap of one line between two records,I don't want that one line gap.I want output in the below format: 

201280,C,R,21.4.2009,21.4.2009,"HSBC HLDG","GB0005405286","00001/20090421-1006851",188.00 
0000,"TITBB/F"," ",22.4.2009,0.00,,"NOTHING GENEVA","ADK"," ","GB411161","SF-0357690"," ","FR"," " 
"201279,C,P,21.4.2009,21.4.2009,"HSBC HLDG","GB0005405286","00001/20090421-1401548",188.00 
0000,"TITBB/F"," ",22.4.2009,0.00,,"NOTHING GENEVA","ADK"," ","GB411161","SF-0357689"," ","FD"," " 

上記の出力を達成するのを手伝ってください。

答えて

2

を私はあなたの問題はあなたの行サイズが125に設定されていることですが、あなたの出力は187文字(あると信じてとにかく最初の行)。 sqlplusは、行を折り返すときに、余分なスペースを入れて、折り返し行の終わりと終わりのどちらが始まるかを知らせます。

125(個人的には私のスクリプトでは、私は自分自身でラッピングをすることができます、ありがとう、sqlplus)、または空白を削除するためにsedを通して結果を実行します:

cat myResultFile.txt | sed '/^$/d' > newResultFile.txt 
+0

それは私が欲しいものを正確に動作させる... atonn steveに感謝!!! –

0

あなたは、レコード分離はオンになっている場合があります:

SET RECSEP EACH 

試してみてください。

SET RECSEP OFF 
+0

私は正しい結果セットを与えてくれてありがとう! –

関連する問題