cancel
Showing results for 
Search instead for 
Did you mean: 

Add support for temporary views

VolkerBarth
Contributor
1,232

While SQL Anywhere has supported temporary procedures and functions for a long time (at least with ASA 9 and above), views can only be created either permanently or on a per-statement level via common table expressions.

I would appreciate a CREATE TEMPORARY VIEW statement enhancement with all the reasons why temporary procedures and local temporary tables are useful:

  • They would be only visible to the current connection,
  • would not appear in the system catalog and transaction log,
  • would be dropped automatically when the connection is dropped but could be explicitly dropped beforehand.

My current use case is a complex analysis of some data which requires several complex views, so it would be quite difficult to use CTE for those, and on the other hand those views are focussed on that particular use case and won't be generally usable, so I would like to restrict them to the current connection and avoid them as permanent views.


Of course, please tell me if there is already a way to use temporary views:)

Accepted Solutions (0)

Answers (1)

Answers (1)

Breck_Carter
Participant

I agree 100%... the WITH clause is very useful, and I use it quite often to create multiple "cascading" view definitions to divide-and-conquer a difficult query... they are easier to code and debug than derived tables embedded in the final FROM.

...BUT a separate CREATE TEMPORARY VIEW statement would be even better because it would allow you to code it once and then use it in multiple separate queries.

In particular, it would be useful for building complex adhoc queries in Foxhound, especially if it had the same "Privileges" requirement as CREATE TEMPORARY PROCEDURE: "You do not need any privilege to create temporary procedures."

In other words, any user with SELECT privileges on the underlying tables would be able to use CREATE TEMPORARY VIEW with no extra privileges.