2017-02-16 20 views
-4
select sum((
SELECT 
SUM (gb.period_net_dr - gb.period_net_cr) "PTD" 
FROM gl_balances gb, gl_code_combinations gcc 
WHERE 
    gb.period_name = NVL(:P_PERIOD,gb.period_name) 
AND gb.currency_code = (SELECT currency_code FROM gl_ledgers WHERE ledger_id = gb.ledger_id) 
AND gcc.segment4 =(select FLEX_VALUE from FND_FLEX_VALUES_VL where description ='Pass Through Costs To Be Realised') 
AND gb.code_combination_id = gcc.code_combination_id) 
+ 
(SELECT 
SUM (gb.period_net_dr - gb.period_net_cr) "PTD" 
FROM gl_balances gb, gl_code_combinations gcc 
WHERE 
    gb.period_name = NVL(:P_PERIOD,gb.period_name) 
AND gb.currency_code = (SELECT currency_code FROM gl_ledgers WHERE ledger_id = gb.ledger_id) 
AND gcc.segment4 =(select FLEX_VALUE from FND_FLEX_VALUES_VL where description ='Pass Through Costs Realised') 
AND gb.code_combination_id = gcc.code_combination_id)) as Total_Pass_Through_Costs 
from 
dual) 
(select sum((
SELECT 
SUM (gb.period_net_dr - gb.period_net_cr) "PTD" 
FROM gl_balances gb, gl_code_combinations gcc 
WHERE 
    gb.period_name = NVL(:P_PERIOD,gb.period_name) 
AND gb.currency_code = (SELECT currency_code FROM gl_ledgers WHERE ledger_id = gb.ledger_id) 
AND gcc.segment4 =(select FLEX_VALUE from FND_FLEX_VALUES_VL where description ='Services Billing') 
AND gb.code_combination_id = gcc.code_combination_id) 
+ 
(SELECT 
SUM (gb.period_net_dr - gb.period_net_cr) "PTD" 
FROM gl_balances gb, gl_code_combinations gcc 
WHERE 
    gb.period_name = NVL(:P_PERIOD,gb.period_name) 
AND gb.currency_code = (SELECT currency_code FROM gl_ledgers WHERE ledger_id = gb.ledger_id) 
AND gcc.segment4 =(select FLEX_VALUE from FND_FLEX_VALUES_VL where description ='pass Through Billing') 
AND gb.code_combination_id = gcc.code_combination_id)) as Total_Billing 
from 
dual 

如何消除這種誤差 (java.sql.SQLSyntaxErrorException:ORA-00933:SQL命令不能正確地結束)如何消除這種誤差

+0

你什麼時候得到錯誤?你想做什麼 ? –

+0

這是幾個單獨的查詢... – jarlh

+0

我得到兩個這(Total_Billing,Total_Pass_Through_Costs)。 –

回答

0

有2個brakets不具有對:

  • 1日沒有任何地方打開
  • 第二沒有任何地方關閉

ç你檢查從字符串的腳架:

... 
from 
dual) 
(select sum... 

他們似乎並沒有打開/關閉任何地方。

0

修復您的查詢中的實際錯誤不會使其對任何其他人搜索答案有用的答案。

然而,找到這類問題的一些(顯而易見的)技巧可能會有用。

所以。 。 。

  • 編輯查詢到的東西很好地結構化(問題有時只是跳出你)
  • 縮進適當地裝上一個單獨的線子查詢支架和他們垂直對齊。
  • 使用,突出括號匹配

修復這種錯誤的編輯器是一個基本的技能,程序員需要學習自己幾乎任何語言。