sql error

the below code was working well for me , then suddenly it didn't , it sent me message that sql commande not probaly ended

with p as ( select &Select_Year yr , &Select_Month mn from dual)
select code_trans , acct_type(code_trans), get_acc_name(code_trans) Acc_Name,sum(bal) Diff 
from (  
select 
code_trans, -op_deb op_deb, -tr_deb tr_deb,  -t_deb t_deb, -op_cr op_cr, -tr_cr tr_cr,  -t_cr t_cr,  -Bal bal, 'Sigma' Syst
FROM h2002_acc_bal t join p on  t.year = p.yr and t.period_no= p.mn)
union all
select 
acc_no, op_deb, tr_deb , op_deb+ tr_deb t_deb , op_cr , tr_cr , op_cr+ tr_cr t_cr,
(op_deb+tr_deb)-(op_cr+tr_cr) Bal , 'Beta'
FROM acc_bal f join p on  f.year = p.yr and f.period_no= p.mn)
where  acct_type(code_trans) <> 1
group by code_trans
having sum(bal) > = 1 or sum(bal) < = -1
order by sum(bal) desc;

Open in new window


what is wrong in the above code ?
NiceMan331Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

sdstuberCommented:
>>>> FROM acc_bal f join p on  f.year = p.yr and f.period_no= p.mn)


That closing parentheses does not have a corresponding open parentheses "("
0
NiceMan331Author Commented:
THE opened parentheses is in line 3
0
johnsoneSenior Oracle DBACommented:
The open parenthesis on line 3 is closed on line 6.  The one that is being referred to by sdstuber is on line 11.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

NiceMan331Author Commented:
yes correct , i adjust it
but it sent me another message :
"bal" invalid  identifier
0
sdstuberCommented:
If you put the "(" in the wrong place it would make sense that "bal" wouldn't be known because scoping would be wrong.

what does your "corrected" code look like?
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
NiceMan331Author Commented:
here it is

with p as ( select &Select_Year yr , &Select_Month mn from dual)
select code_trans , acct_type(code_trans), get_acc_name(code_trans) Acc_Name,sum(bal) Diff 
from (  
select 
code_trans, -op_deb op_deb, -tr_deb tr_deb,  -t_deb t_deb, -op_cr op_cr, -tr_cr tr_cr,  -t_cr t_cr,  -Bal bal, 'Sigma' Syst
FROM h2002_acc_bal t join p on  t.year = p.yr and t.period_no= p.mn)
union all
select 
acc_no, op_deb, tr_deb , op_deb+ tr_deb t_deb , op_cr , tr_cr , op_cr+ tr_cr t_cr,
(op_deb+tr_deb)-(op_cr+tr_cr)  , 'Beta'
FROM acc_bal f join p on  f.year = p.yr and f.period_no= p.mn
where  acct_type(code_trans) <> 1
group by code_trans
having sum(bal) > = 1 or sum(bal) < = -1
order by 4 desc;

Open in new window

0
NiceMan331Author Commented:
it is now works , the mistake in the paranthese
thanx
with p as ( select &Select_Year yr , &Select_Month mn from dual)
select code_trans , acct_type(code_trans), get_acc_name(code_trans) Acc_Name,sum(bala) Diff 
from (  
select 
code_trans, -op_deb op_deb, -tr_deb tr_deb,  -t_deb t_deb, -op_cr op_cr, -tr_cr tr_cr,  -t_cr t_cr,  -Bal bala, 'Sigma' Syst
FROM h2002_acc_bal t join p on  t.year = p.yr and t.period_no= p.mn
union all
select 
acc_no, op_deb, tr_deb , op_deb+ tr_deb t_deb , op_cr , tr_cr , op_cr+ tr_cr t_cr,
(op_deb+tr_deb)-(op_cr+tr_cr)  , 'Beta'
FROM acc_bal f join p on  f.year = p.yr and f.period_no= p.mn)
where  acct_type(code_trans) <> 1
group by code_trans
having sum(bala) > = 1 or sum(bala) < = -1
order by 4 desc;

Open in new window

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Oracle Database

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.