Josh
Josh

Reputation: 307

CTEs in Oracle 10g - "unsupported column aliasing"

I receive the following error when I try to execute a sql statement that uses a CTE:

ORA-32033: unsupported column aliasing
32033. 00000 -  "unsupported column aliasing"
*Cause:    column aliasing in WITH clause is not supported yet
*Action:   specify aliasing in defintion subquery and retry
Error at Line: 1 Column: 9

The code I am trying to execute is:

WITH cte1
(
  SELECT *
  FROM test_table
)
SELECT *
FROM cte1;

I know this is a simple statement and there is no need to use a CTE, but I am just trying to start using CTEs in Oracle (I am coming from T-SQL).

Why doesn't the code execute?

Upvotes: 3

Views: 6156

Answers (2)

Bridge
Bridge

Reputation: 30651

You're missing the AS:

WITH cte1 AS
(
  SELECT *
  FROM test_table
)
SELECT *
FROM cte1;

Upvotes: 9

Josh
Josh

Reputation: 307

I just figured this out - I need the AS keyword after the CTE name. So the statement should be:

WITH cte1 AS
(
  SELECT *
  FROM test_table
)
SELECT *
FROM cte1;

Upvotes: 8

Related Questions