Home » SQL & PL/SQL » SQL & PL/SQL » Error in code - need help (9i , win xp)
Error in code - need help [message #333543] Sat, 12 July 2008 07:48 Go to next message
adilsami
Messages: 46
Registered: October 2007
Member
Hi there,
can anyone help me in identifying the error in this code



select 
pm.orgnisation_id,
pm.group_code,
pm.machine_code,
pw.employee_id,
last_day(trunc(pw.production_date, 'MONTH') production_date,

decode (pw.emplyee_id,'999',sum(nvl(pw.manpower*pw.normal_hours,0)+nvl(pw.holiday_hours,0)),
                      'A999',sum(nvl(pw.manpower*pw.normal_hours,0)+nvl(pw.holiday_hours,0)),
                      '333',sum(nvl(pw.manpower*pw.normal_hours,0)+nvl(pw.holiday_hours,0)),
                            sum(nvl(pw.normal_hours,0))) A,
                            sum(nvl(pw.overtime_hours,0)) OVT_HRS,
                            nvl(emsc.cost_per_hrs,0) B,

decode(pw.emplyee_id,'999',sum(nvl(pw.manpower*pw.normal_hours,0)+nvl(pw.holiday_hours,0)),
                    'A999',sum(nvl(pw.manpower*pw.normal_hours,0)+nvl(pw.holiday_hours)),
                    '333',sum(nvl(pw.manpower*pw.normal_hours,0)+nvl(pw.holiday_hours)),
					 	   sum(nvl(pw.normal_hours,0)))*nvl(emsc.cost_per_hrs,0) C,
						  (sum(nvl(pw.overtime_hours,0))*1.5)*nvl(emsc.cost_per_hrs,0) OVT_ABS,

decode(pw.employee_id,'999',0,
					  'A999',0,
					  '333',0,
					  sum(nvl(pw.holiday_hours,0)*2)*nvl(emsc.cost_per_hrs,0) HLD_ABS,

decode(eta.d,0,0,(
(decode(pw.employee_id,'999',sum(nvl(pw.manpower*pw.normal_hours,0)+nvl(pw.holiday_hours,0)),
     				   'A999',sum(nvl(pw.manpower*pw.normal_hours,0)+nvl(pw.holiday_hours,0)),
					   '333',sum(nvl(pw.manpower*pw.normal_hours,0)+nvl(pw.holiday_hours,0)),
					     	sum(nvl(pw.normal_hours,0)))/eta.d)*mev.f) G,

decode(eta.d,0,0,
(decode(pw.employee_id,'999',sum(nvl(pw.manpower*pw.normal_hours,0)+nvl(pw.holiday_hours,0)),
		               'A999',sum(nvl(pw.manpower*pw.normal_hours,0)+nvl(pw.holiday_hours,0)),
                       '333',sum(nvl(pw.manpower*pw.normal_hours,0)+nvl(pw.holiday_hours,0)),
					 	   sum(nvl(pw.normal_hours,0)))*nvl(emsc.cost_per_hrs,0)+

(decode(pw.employee_id,'999',sum(nvl(pw.manpower*pw.normal_hours,0)+nvl(pw.holiday_hours,0)),
		               'A999',sum(nvl(pw.manpower*pw.normal_hours,0)+nvl(pw.holiday_hours,0)),
                       '333',sum(nvl(pw.manpower*pw.normal_hours,0)+nvl(pw.holiday_hours,0))
					        sum(nvl(pw.normal_hours,0)))/eta.d)*mev.f)) H
							 
from
p_machines pm,
p_manpower pw,
emp_mon_std_cost emsc,
emp_tot_act eta,
mch_emp_var mev

where
    pm.orgnisation_id = pw.orgnisation_id
and pm.orgnisation_id = emsc.orgnisation_id
and pm.orgnisation_id = eta.orgnisation_id
and pm.orgnisation_id = mev.orgnisation_id
--and pm.orgnisation_id = 313 
and pm.group_code = pw.group_code
and pm.machine_code = pw.machine_code
and pw.employee_id = emsc.employee_id
and pw.employee_id = eta.employee_id
and pw.employee_id = mev.employee_id
and last_day(trunc(pw.production_date,'MONTH')) = emsc.dmonth
and last_day(trunc(pw.production_date,'MONTH')) = eta.production_date 
and last_day(trunc(pw.production_date,'MONTH')) = mev.pdate
--and last_day(trunc(pw.production_date,'MONTH')) > '31-mar-2004''
group by
pm.orgnisation_id,
pm.group_code,
pm.machine_code,
pw.employee_id,
last_day(trunc(pw.production_date,'MONTH')),
emsc.cost_per_hrs,
eta.d,
mev.f)


Re: Error in code - need help [message #333546 is a reply to message #333543] Sat, 12 July 2008 09:04 Go to previous messageGo to next message
BlackSwan
Messages: 25036
Registered: January 2009
Location: SoCal
Senior Member
http://www.orafaq.com/forum/t/88153/0/
Please read & follow Posting Guideline as stated above

No clues possible with such limited information.
Re: Error in code - need help [message #333551 is a reply to message #333543] Sat, 12 July 2008 09:57 Go to previous messageGo to next message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Error? Which error?

Regards
Michel
Re: Error in code - need help [message #333559 is a reply to message #333543] Sat, 12 July 2008 12:00 Go to previous messageGo to next message
pablolee
Messages: 2834
Registered: May 2007
Location: Scotland
Senior Member
missing bracket.
Re: Error in code - need help [message #333561 is a reply to message #333559] Sat, 12 July 2008 12:21 Go to previous messageGo to next message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Yes and it seems some use function they don't understand.

Regards
Michel
Re: Error in code - need help [message #333562 is a reply to message #333561] Sat, 12 July 2008 14:07 Go to previous message
pablolee
Messages: 2834
Registered: May 2007
Location: Scotland
Senior Member
lol, yes, took me a couple of seconds.
Previous Topic: Decode Function Help
Next Topic: open-for-using statement
Goto Forum:
  


Current Time: Sun Dec 04 08:41:15 CST 2016

Total time taken to generate the page: 0.08014 seconds