No, alias references are not allowed in SQL views and MQTs.
One way to encapsulate an alias reference would to be use a user-defined table function (UDTF):
CREATE FUNCTION aliasudtf()
RETURNS TABLE(col2 char(6), col3 int)
LANGUAGE SQL
NO EXTERNAL ACTION
DETERMINISTIC
DISALLOW PARALLEL
BEGIN
Return (
select c2,c3 from alias1
union all
select c2,c3 from alias2);
END;
Here's an example of how to reference a UDTF on a SELECT statement. UDTF references are allowed when creating SQL views and materialized query tables (MQTs).
SELECT col2 FROM TABLE( aliasudtf() ) x;
|