简体   繁体   中英

SQL View with table variables

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;

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM