Your Answer is really helpful, But I am facing one issue. I have an existing application which earlier uses syntax like
CREATE TABLE <TABLE NAME> as <TABLE NAME> now we have introduced a view layer in it so now the query generated as
CREATE TABLE <TABLE NAME> as <VIEW NAME> which is giving me an error that <VIEW NAME> is not a table.
Is it possible that the above query can run just by some modification is DB instead of changing the query so that I do not need to change the existing system.
The above queries are generated to create the work table and stage table.
No it is not possible.
You could change you script to look at the tablekind in dbc tables and substitute the select * format whenever you run into a view.