0

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;
john
  • 796
  • 1
  • 13
  • 34

1 Answers1

2

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.

Lars Br.
  • 9,949
  • 2
  • 15
  • 29