Reputation: 834
Is it possible to create a view and that view to contain table variables for example like this:
create view "USERS_VIEW" as
tt = select * from "UsersTable" where "UserID" in (128,129);
select * from :tt
with READ ONLY;
Upvotes: 0
Views: 733
Reputation: 10388
Table variables are only available in SQLSCRIPT but not in standard SQL.
So, that doesn’t work with CREATE VIEW
.
However, it’s possible to create a procedure with a view to access the procedure result set.
To do that use the WITH RESULT VIEW
(see documentation) keyword with the CREATE PROCEDURE
statement.
Upvotes: 2