QUERY GIVING ERROR SQL COMMAND NOT PROPERLY ENDED [message #7103] |
Wed, 21 May 2003 06:12 |
vimal
Messages: 46 Registered: February 2000
|
Member |
|
|
hello
friends i m facing very sill problem the below statement run successfully when i union the same with same query it give ora 00933 sql command not properly ended please please help me its urgent
select to_char(post_cd) post, a.emp_Cd ,emp_first_nam||' ' ||emp_mid_nam||' '||emp_sur_nam ,
915 perk_Cd,perk_desc , nvl(sum(nvl(a.amount,0) -nvl( b.amount,0)),0) from
th_payslipdet a , th_payslipdet b , tmd_empdtls d,tmd_employeepay f,
( select 'NET PAY' perk_desc from dual ) g
where a.perk_cd =910
and b.perk_cd =912
and a.month=:month
and b.month=:month
and a.fin_year= :year
and a.proc_typ_ind <> 'ARR'
and b.fin_year= :year
and b.proc_typ_ind <> 'ARR'
and a.emp_Cd=b.emp_Cd
and a.emp_cd = d.emp_Cd
and a.emp_cd= f.emp_cd
and payserial_no =DECODE(:PAYSERIAL_NO,NULL,f.PAYSERIAL_NO,:PAYSERIAL_NO)
group by d.post_cd, a.emp_cd,emp_first_nam||' ' ||emp_mid_nam||' '||emp_sur_nam
order by to_number(post)
union
select to_char(post_cd) post, a.emp_Cd ,emp_first_nam||' ' ||emp_mid_nam||' '||emp_sur_nam ,
915 perk_Cd,perk_desc , nvl(sum(nvl(a.amount,0) -nvl( b.amount,0)),0) from
th_payslipdet a , th_payslipdet b , tmd_empdtls d,tmd_employeepay f,
( select 'NET PAY' perk_desc from dual ) g
where a.perk_cd =910
and b.perk_cd =912
and a.month=:month
and b.month=:month
and a.fin_year= :year
and a.proc_typ_ind <> 'ARR'
and b.fin_year= :year
and b.proc_typ_ind <> 'ARR'
and a.emp_Cd=b.emp_Cd
and a.emp_cd = d.emp_Cd
and a.emp_cd= f.emp_cd
and payserial_no =DECODE(:PAYSERIAL_NO,NULL,f.PAYSERIAL_NO,:PAYSERIAL_NO)
group by d.post_cd, a.emp_cd,emp_first_nam||' ' ||emp_mid_nam||' '||emp_sur_nam
order by to_number(post)
bye
|
|
|
|
|
Re: QUERY GIVING ERROR SQL COMMAND NOT PROPERLY ENDED [message #517715 is a reply to message #517714] |
Wed, 27 July 2011 10:42 |
cookiemonster
Messages: 13920 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
@shashank_kurasrediffmail
1) Please have a read of the fourm guide, especially point 8.
2) Posting in all caps is considered shouting on all internet forums, please don't do it.
3) This thread is 8 years old. While we appreciate the fact that you're trying to help it would be more useful if you answered questions from this year.
4) Union does a sort, so it can reorder data. Consequently your suggestion won't work.
EDIT: typo
[Updated on: Wed, 27 July 2011 10:51] Report message to a moderator
|
|
|