2012-11-30 36 views
2

我想創建一個空列。我想這如何在不包含值的表的末尾創建空列

select LOSA_APP.app_ref_no AS "App.Ref.No.", 
    CODE_BRANCH.branch_name AS "Business Unit", 
    CODE_STAFF.staff_name AS "RM", 
    to_date(:endDate, 'dd.mm.yyyy') - LOSA_APP_Z.li_dt AS "Day Count", 
    ..., 
    (select "RemarK By SDS" from dual) 
from 
    losa_app LOSA_APP 
INNER JOIN 
    code_branch CODE_BRANCH 
ON 
    LOSA_APP.attend_branch = CODE_BRANCH.branch_id 
.... 
where 
    LOSA_APP.app_status='A'; -- Application Status in {‘accepted’} 

但是我得到錯誤

ORA-00904: "RemarK By SDS": invalid identifier 
00904. 00000 - "%s: invalid identifier" 
*Cause:  
*Action: 
Error at Line: 22 Column: 16 

線22 (select "RemarK By SDS" from dual)。其實我只是想在最後添加這個空列來進行評論。此欄不包含任何值。

感謝

回答

2

嘗試:

select LOSA_APP.app_ref_no AS "App.Ref.No.", 
    CODE_BRANCH.branch_name AS "Business Unit", 
    CODE_STAFF.staff_name AS "RM", 
    to_date(:endDate, 'dd.mm.yyyy') - LOSA_APP_Z.li_dt AS "Day Count", 
    ..., 
    '' as "RemarK By SDS" 
from 
    losa_app LOSA_APP 
..... 

而不是(select "RemarK By SDS" from dual)使用只是'' as "RemarK By SDS"它可以讓你在結果集的末尾空列。

相關問題