jadams0173
Technical User
- Feb 18, 2005
- 1,210
To say I'm a novice in Oracle 8i is an understatement.
I'm trying to run this code as one statement and I get the error ORA-00933: SQL command not properly ended.
If I run the insert first and then the selects it works. Why can't I run it all together. Also Table1 is a global temp table.
I'm trying to run this code as one statement and I get the error ORA-00933: SQL command not properly ended.
If I run the insert first and then the selects it works. Why can't I run it all together. Also Table1 is a global temp table.
Code:
INSERT INTO TABLE1
(ASSY_ID)
( SELECT DISTINCT ASSEMBLY_ID FROM SNAPMAN.ASSY_PT)
SELECT SO.ITEM, 'HLA' TYPE
FROM PROD.V_SHOPORDER SO, SNAPMAN.ASSY_PT AP
WHERE SO.ITEM = AP.ASSEMBLY_ID AND SO.RELEASED_QTY > 0
GROUP BY SO.ITEM, 'HLA'
UNION ALL
SELECT SO.ITEM, 'OTHER' TYPE
FROM PROD.V_SHOPORDER SO, SNAPMAN.ASSY_PT AP , TABLE1 TT
WHERE SO.ITEM = AP.COMPONENT_ID AND SO.RELEASED_QTY > 0
AND SO.ITEM = TT.ASSY_ID (+)--NOT IN(SELECT DISTINCT ASSEMBLY_ID FROM SNAPMAN.ASSY_PT)
AND TT.ASSY_ID IS NULL
GROUP BY SO.ITEM, 'OTHER' ,TT.ASSY_ID