2013-03-04 39 views
-1

大家好,我正在尋找一些關於如何將撇號添加到我的第一列的查詢結果的指針。concat撇號到oracle sql查詢

我當前的查詢:

set verify off 
set colsep "'," 
set pagesize 2000 
ALTER SESSION SET NLS_DATE_FORMAT='DD-MON-YY-HH24:MI:SS'; 
spool /home/user/out.txt 

select '[' || table1.collectdatetime as "['Date-Time",table1.cycletime as "'Time'" from table1 where interfacename='somename' and collectdatetime > (CURRENT_DATE - 1) 
order by collectdatetime ASC; 

導致:

['Date-Time  ','InCycleTime' 
-------------------',------------- 
[02-MAR-13-17:56:16',   29 

我所用越來越結果struglling返回和[

['Date-Time  ','InCycleTime' 
-------------------',------------- 
['02-MAR-13-17:56:16',   29 

後面加一個撇號

這是爲一個或acle 11.1.0.7 build。數據正在被查詢和解析,但我需要得到這個撇號問題。

回答

0

使用本:

select '[''' || table1.collectdatetime as "['Date-Time",table1.cycletime as "'Time'" from table1 where interfacename='somename' and collectdatetime > (CURRENT_DATE - 1) 
order by collectdatetime ASC; 
+0

太好了,謝謝這麼多。 – user1999357 2013-03-04 00:34:08