page261
348
AS
SELECT customer_key, customer_name, '********', order_date, nation_name
FROM base_customer_order WHERE region_name = 'AFRICA';
/* Entitle new objects to share */
USE ROLE securityadmin;
GRANT SELECT ON tpc.share_owner_POC.base_customer_order TO SHARE share_POC;
/* Entitle new role to access objects in both existing schema and new
schema */
GRANT SELECT ON ALL TABLES IN SCHEMA tpc.share_owner_POC TO
ROLE share_owner_role;
GRANT SELECT ON ALL DYNAMIC TABLES IN SCHEMA tpc.share_owner_POC TO
ROLE share_owner_role;
GRANT SELECT ON ALL MATERIALIZED VIEWS IN SCHEMA tpc.share_owner_POC TO
ROLE share_owner_role;
/* Make share available to consumer account */
USE ROLE accountadmin;
ALTER SHARE share_POC ADD ACCOUNTS = 'ABC123';
Deploying Generated Code
The following stored procedure
sp_create_share
can be extended in several ways. For
example:
•
Writing output to a logging table
•
Building tables, not views
•
Generating test cases
Regardless of the actual code generated, I strongly recommend full testing is
conducted with business sign-off before deployment.
Chapter 9
Client expeCtations