on 10-07-2015 2:35 AM
Someone recently asked how a HANA DATABASE view (not calculation/analytic/attribute view) can have a mandatory input parameter/variable/where clause attached to it. From this, I remembered that there is a system view (“SYS”.”EFFECTIVE_PRIVILEGES”) that requires you to pass a USER_NAME into it when you want to run a query on it. When you query without this (SELECT *), you see this error.”
Now my question is – how can I generate a database view with a mandatory predicate in the same way? This must be a super secret view (SYS.EFFECTIVE_PRIVILEGES), since no one (even SYSTEM) can see the definition of this view and I can't seem to find any documentation on how to accomplish this.
Regards,
Justin
Ok, that's an easy answer to give but maybe a difficult one to accept:
System views are special.
They can be created via SQL, L, C++ code - all compiled right into the SAP HANA software executable. That's the reason that typically the "source code" is not visible: they are not created like this and are defined "outside the matrix of the SQL catalog".
So that way, the possible semantics can be richer, e.g. by demanding a specific WHERE condition or parameter. Other examples would be the check for a specific system privilege within the view and changing data output accordingly.
So, in short: SAP HANA core developers can practically create whatever they want.
But there is no (straightforward) way to force a SQL view to check the existence of the WHERE condition it was invoked with.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.