Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - micdavhen

Pages: [1]
1
PSOUG / Multiple Errors?
« on: March 23, 2009, 05:22:34 PM »
What am I doing wrong with this SQL statement?

Code: [Select]
WITH
LEADTIME AS
(
select
a.iblitm as "Part Number",
a.ibltlv as "LeadTime",
to_char(to_date(substr(lpad(a.ibupmj, 6, '0'),4)|| (1900 + substr(lpad
(a.ibupmj, 6, '0'), 1, 3)),'dddyyyy'), 'mm/dd/yyyy') as "Date",
rank( )Over(Partition by a.iblitm, a.ibltlv order by a.ibupmj asc) as Rank_List
from proddta.f554102T a
where ibitm = '660722'
and ibmcu = lpad('680', 12)),

SUMMARY AS
(Select Distinct
LEADTIME."Part Number" as PartNumber,
MAX(LEADTIME."Date") AS MaxDate
FROM LEADTIME
WHERE LEADTIME.RANK_LIST = 1
group by LEADTIME."Part Number" )
SELECT
SUMMARY.PartNumber,
LEADTIME."LeadTime",
SUMMARY.MaxDate < sysdate as "NewDate"
from LEADTIME, SUMMARY
WHERE
LEADTIME."Part Number" = SUMMARY.PartNumber
AND LEADTIME."Date" = SUMMARY.MaxDate

and SUMMARY.MaxDate < to_char(to_date(sysdate, 'mm/dd/yy'))
GROUP BY
SUMMARY.PartNumber,
SUMMARY.MaxDate,
"LeadTime",
Rank_List
ORDER BY 'DATE' asc
These are the errors I am receiving...

-- ORA-00903: invalid table name
-- ORA-00900: invalid SQL statement
-- ORA-00928: missing SELECT keyword
-- ORA-00933: SQL command not properly ended

Any Suggestions?

Pages: [1]