3. Neue AP Funktionen SET CURRENT PACKAGESET
{"Image DocumentName": "3. Neue AP Funktionen SET CURRENT PACKAGESET", "Image ImageDescription": "Problem: CURRENT SQLID als impliziter Qualifier f\u00fcr \u201edynamic SQL CURRENT SQLID betrifft u.a. die \u201eauthorization : CURRENT SQLID mu\u00df f\u00fcr \u201edynamic CREATE, ALTER, GRANT REVOKE authorisiert werden. CURRENT SQLID mu\u00df eine \u201eprimary / secondary auth ID sein (au\u00dfer bei SYSADM / SYSCTRL) Static SQL nutzt deshalb die BIND Option \u201eQUALIFIER gilt f\u00fcr \u201eunqualified SQL L\u00f6sung: SET SCHEMA / CURRENT SCHEMA Spezialregister f\u00fcr \u201edyn SQL CURRENT SCHEMA ist ein Spezialregister mit VARCHAR(128) und demselben Wert wie CURRENT SQLID zum Zeitpunkt der Initialisierung. Verlangt SET SCHEMA zum \u00c4ndern. Kann jeden beliebigen Wert annnehmen (nicht begrenzt auf \u201eprimary /secondary auth ID wie CURRENT SQLID) Customers often run applications with different qualifiers in effect for unqualified names, without having to have separate copies of the application code itself. They then deploy theapplication in different environments (sometimes on the same DB2 subsystem) without have to change any of the application code. With DB2 for z/OS and OS/390 V7, an application can be coded without qualifiers for objectnames (also known as unqualified SQL), and an implicit qualifier will be used for unqualified names. For static SQL statements, the DB2 QUALIFIER option for BIND can be used, to specify theimplicit qualifier for unqualified object names (except for those contexts which use the SQL PATH to resolve the name of an object). The QUALIFIER bind option affects the implicit qualification of unqualified object names. If the QUALIFIER bind option is not specified, the OWNER of the plan or package is used as the implicit object qualifier for static SQL statements. For dynamic SQL statements, the CURRENT SQLID special register can be used to specify the implicit qualifier for unqualified object names (except for those contexts which use the SQL PATH to resolve the name of an object). However, unlike the QUALIFIER bind option, the use of the CURRENT SQLID special register has other effects, as it is also used for authorization checking on dynamic CREATE, ALTER, GRANT, and REVOKE statements, and the value is also used as the owner (or definer) of objects created with dynamic CREATE statements. The current (V7) support for specifying an implicit qualifier for dynamic SQL statements (CURRENT SQLID) is not quite the same as the support for static SQL statements (the QUALIFIER bind option). The bundling of qualification of object name with the authorization checking, and ownership of objects is not an ideal solution for dynamic SQL statements. Again DB2 for z/OS Version 8 comes to the rescue. V8 introduces a new SET (CURRENT) SCHEMA SQL statement, and a new special register CURRENT SCHEMA. It is only used to qualify object names in unqualified dynamic SQL statements (when DYNAMICRULES(RUN) are in effect, the default). The CURRENT SCHEMA special register is initialized with the value of the CURRENT SQLID at initialization time. You can then change it in your application using the SET SCHEMA SQL statement. You can set the CURRENT SCHEMA special register to any valid string (as long as the string you provide is a VARCHAR(128)). This is different from changing the CURRENT SQLID. There you have to specify you your primary authorization ID or one of your secondary authorization IDs (unless you are SYSADM or SYSCTRL). The CURRENT SCHEMA special register is only used for qualifying unqualified SQL in your program, nothing else. Setting the CURRENT SCHEMA special register does not affect any other special register. Therefore, the CURRENT SCHEMA is not to be included in the SQL path that is used to resolve the schema name for unqualified references to function, procedures, and user-defined types in dynamic SQL statements. To include the current schema value in the SQL path, whenever the SET SCHEMA statement is issued, also issue the SET PATH statement including the schema name from the SET SCHEMA statement. When the name of the object to be created is specified as an unqualified name, in case of a dynamic CREATE statement, the value of CURRENT SCHEMA must be the same as the CURRENT SQLID special register. Otherwise an SQLCODE is issued,", "Image XResolution": "37", "Image YResolution": "37", "Image ResolutionUnit": "Pixels/Centimeter", "Image Software": "SlidePlayer", "Image YCbCrPositioning": "Centered"}