page259
346
result += "CREATE OR REPLACE VIEW tpc.share_owner_" + P_CLIENT_
NAME + "." + recset.getColumnValue(2) + "\n"
result += "AS\n"
result += recset.getColumnValue(3) + ";\n\n"
share_grants += "GRANT SELECT ON tpc.share_owner_" + P_CLIENT_NAME
+ "." + recset.getColumnValue(2) + " TO SHARE share_" + P_CLIENT_
NAME + ";\n"
}
}
catch(err)
{
err_state += "\nFail Code: " + err.code;
err_state += "\nState: " + err.state;
err_state += "\nMessage: " + err.message;
err_state += "\nStack Trace:" + err.StackTraceTxt;
err_state += "\nSQL Statement:\n\n" + result;
result = err_state;
}
result += "/* Entitle new objects to share */\n"
result += "USE ROLE securityadmin;\n"
result += share_grants + "\n";
result += "/* Entitle new role to access objects in both existing schema
and new schema */\n"
result += "GRANT SELECT ON ALL TABLES
IN SCHEMA tpc.share_owner_" + P_CLIENT_NAME + " TO ROLE share_owner_
role;\n"
result += "GRANT SELECT ON ALL DYNAMIC TABLES
IN SCHEMA tpc.share_owner_" + P_CLIENT_NAME + " TO ROLE share_owner_
role;\n"
result += "GRANT SELECT ON ALL MATERIALIZED VIEWS
IN SCHEMA tpc.share_owner_" + P_CLIENT_NAME + " TO ROLE share_owner_
role;\n\n"
result += "/* Make share available to consumer account */\n"
Chapter 9
Client expeCtations