I am trying to add this query in a view, while test it works fine and no syntax error but when click save, I get this error
ORA-00907: missing right parenthesis
This is the query:
SELECT
importer_id,
AVG(count),
STDDEV(count),
AVG(count) + STDDEV(count) * 2 AS baseline
FROM
(SELECT
COUNT(declaration_identifier) AS count,
EXTRACT(MONTH FROM declaration_date) AS month,
importer_id
FROM
declaration
GROUP BY
importer_id,
EXTRACT(MONTH FROM declaration_date)
)
GROUP BY
importer_id
I created a dummy table to get your view to compile.
create table declaration
( declaration_identifier integer,
declaration_date date,
importer_id integer
);
I then wrapped your query with a CREATE VIEW...
CREATE VIEW SO_ERROR
AS SELECT
imp_id as id,
AVG(count) as count,
STDDEV(count) as stddev,
AVG(count) + STDDEV(count) * 2 as baseline
FROM
(
SELECT
COUNT(declaration_identifier) count,
EXTRACT(MONTH FROM declaration_date) month,
importer_id imp_id
FROM
declaration
GROUP BY
importer_id,
EXTRACT(MONTH FROM declaration_date)
)
GROUP BY
imp_id;
Note that every column in the outer select has an ALIAS.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.