Author |
Topic |
ffathiah2
Starting Member
1 Post |
Posted - 2014-07-17 : 04:18:58
|
Hi there, wanna ask your help. I've write down some sql statements here and i used Oracle.Here are the codes:select X.gl_acc_group, X.gl_seq_no, X.gl_accno, X.gl_descr, X.main_group, X.main_descr, X.sub_group, X.descr, X.seq_no, sum(decode(gl_month, '06' --to_char(:P_DATE_TO, 'MM'), nvl(G.amount, 0), 0)) tot_amt, nvl(sum(G.amount), 0) ytd_amtfrom bos_gl_ledger G (select G.acc_group gl_acc_group, G.seq_no gl_seq_no, G.gl_accno, G.descr gl_descr, D.main_group, H.descr main_descr, D.sub_group, D.descr, D.seq_no from bos_m_gl_ht G, bos_m_para H, bos_m_costgroup D where H.para_type = 'COST' and H.para_code = D.main_group and substr(G.gl_accno, 1, 3) in ('130', '140')-- and G.gl_year = '2013' and gl_month = '02') X--and G.gl_year||gl_month between to_char(:P_DATE_FROM, 'YYYYMM') and to_char(:P_DATE_TO, 'YYYYMM')) X and G.gl_year(+) = '2014' --to_char(:P_DATE_TO, 'YYYY') and G.gl_month(+) <= '06' -- to_char(:P_DATE_TO, 'MM')) Xwhere X.gl_accno = G.gl_accno(+)and X.sub_group = G.ref_no(+)-- and G.gl_year(+) = '2013'-- and gl_month(+) = '02'--and G.gl_year(+)||gl_month(+)between to_char(:P_DATE_FROM, 'YYYYMM') and to_char(:P_DATE_TO, 'YYYYMM')and G.gl_year(+) = '2014' --to_char(:P_DATE_TO, 'YYYY')and G.gl_month(+) <= '06' --to_char(:P_DATE_TO, 'MM')group by X.gl_acc_group, X.gl_seq_no, X.gl_accno, X.gl_descr, X.main_group, X.main_descr, X.sub_group, X.descr, X.seq_nohaving nvl(sum(G.amount), 0) <> 0order by X.seq_no, X.gl_accno, X.main_group/At line 3, ERROR at line 3:ORA-00907: missing right parenthesisAnyone knows why?Hi there! Nice to meet u! |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2014-07-17 : 04:53:23
|
Yes. When you decided to comment out some part you got too much!select X.gl_acc_group, X.gl_seq_no, X.gl_accno, X.gl_descr, X.main_group, X.main_descr, X.sub_group, X.descr, X.seq_no, SUM(decode(gl_month, '06' --to_char(:P_DATE_TO, 'MM'), nvl(G.amount, 0), 0)) tot_amt, nvl(sum(G.amount), 0) ytd_amtfrom bos_gl_ledger G ( SELECT G.acc_group gl_acc_group, G.seq_no gl_seq_no, G.gl_accno, G.descr gl_descr, D.main_group, H.descr main_descr, D.sub_group, D.descr, D.seq_no FROM bos_m_gl_ht G, bos_m_para H, bos_m_costgroup D WHERE H.para_type = 'COST' AND H.para_code = D.main_group AND substr(G.gl_accno, 1, 3) in ('130', '140') -- and G.gl_year = '2013' and gl_month = '02') X --and G.gl_year||gl_month between to_char(:P_DATE_FROM, 'YYYYMM') and to_char(:P_DATE_TO, 'YYYYMM')) X and G.gl_year(+) = '2014' --to_char(:P_DATE_TO, 'YYYY') and G.gl_month(+) <= '06' -- to_char(:P_DATE_TO, 'MM')) XWHERE X.gl_accno = G.gl_accno(+) and X.sub_group = G.ref_no(+) -- and G.gl_year(+) = '2013' -- and gl_month(+) = '02' --and G.gl_year(+)||gl_month(+)between to_char(:P_DATE_FROM, 'YYYYMM') and to_char(:P_DATE_TO, 'YYYYMM') and G.gl_year(+) = '2014' --to_char(:P_DATE_TO, 'YYYY') and G.gl_month(+) <= '06' --to_char(:P_DATE_TO, 'MM')group by X.gl_acc_group, X.gl_seq_no, X.gl_accno, X.gl_descr, X.main_group, X.main_descr, X.sub_group, X.descr, X.seq_nohaving nvl(sum(G.amount), 0) <> 0order by X.seq_no, X.gl_accno, X.main_group Microsoft SQL Server MVP, MCT, MCSE, MCSA, MCP, MCITP, MCTS, MCDBA |
|
|
|
|
|