I am having issues with creating a view , the sql query tests successfully from the create view pane as seen on the right pane
Oracle is throwing me an invalid identifier , but oracle does not point to which part of the query
CodePudding user response:
Your example can be simplified to:
CREATE VIEW test AS
SELECT (SELECT 2 FROM DUAL) - (SELECT 1 FROM DUAL)
FROM DUAL;
Which fails as Oracle does not know what to call the column the view generates and SQL Developer is trying to automatically generate the SQL by copying the default alias into the signature:
CREATE VIEW test( (SELECT2FROMDUAL)-(SELECT1FROMDUAL) ) AS
SELECT (SELECT 2 FROM DUAL) - (SELECT 1 FROM DUAL)
FROM DUAL;
Which is an invalid identifier.
Either set the identifier for the column in the query:
CREATE VIEW test AS
SELECT (SELECT 2 FROM DUAL) - (SELECT 1 FROM DUAL) AS value
FROM DUAL;
or in the signature:
CREATE VIEW test(value) AS
SELECT (SELECT 2 FROM DUAL) - (SELECT 1 FROM DUAL)
FROM DUAL;