UNION ALL error
946084Aug 18 2012 — edited Aug 19 2012Hi
I'm having an issue in a new Environment database, which we have just started using in Production. There have been no issues in any of the other environments we use but I am getting either "ORA 00928 Missing Select" or "ORA00935: missing Expresion" or "ORA00911: Invalid Character" errors depending on what I am doing.
The issue I have is that in my view I have two queries joined by a UNION ALL. The query runs fine when I run it manually. When I add the CREATE OR REPLACE VIEW x AS SELECT... the view creates succesfully, and looking in TOAD I can see the view, and there are no issues with it. As soon as I run SELECT * FROM View I get an error?
Has anyone had the same experience or know how to resolve it?
Thanks
Mike
PS;
Full sample Code:
-------------------------------------------------------------------
SELECT * FROM AB.TABLE 1
UNION ALL
SELECT * FROM AB.TABLE 2
(Assume both Table 1 and Table 2 have the exact same same structure) This Works
-------------------------------------------------------------------
CREATE OR REPLACE VIEW AB.VIEW
AS
SELECT * FROM AB.TABLE 1 WHERE ROWNUM < 100
UNION ALL
SELECT * FROM AB.TABLE 2 WHERE ROWNUM < 100
View Creates successfully.
--------------------------------------------------------------------
SELECT * FROM AB.VIEW
This works successfully.
--------------------------------------------------------------------
CREATE OR REPLACE VIEW AB.VIEW
AS
SELECT * FROM AB.TABLE 1
UNION ALL
SELECT * FROM AB.TABLE 2
View Creates Successfully
--------------------------------------------------------------------
SELECT * FROM AB.VIEW
This fails with one of the error messages mentioned above.
--------------------------------------------------------------------
I first got the ORA00911 error, but this has moved on to the 00928 too