2017-02-16 21 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

修复您的查询中的实际错误不会使其对任何其他人搜索答案有用的答案。

然而,找到这类问题的一些(显而易见的)技巧可能会有用。

所以。 。 。

  • 编辑查询到的东西很好地结构化(问题有时只是跳出你)
  • 缩进适当地装上一个单独的线子查询支架和他们垂直对齐。
  • 使用,突出括号匹配

修复这种错误的编辑器是一个基本的技能,程序员需要学习自己几乎任何语言。