473,407 Members | 2,315 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

"Grant a Role"-Statement in Triggers

Hi !

When I insert a new record to a table "table_A" I want to Grant a Role
"Role_X" to the User "User_Y".

So I made a Trigger who should do this work, but it doesn't:

When I write: "GRANT Role_X TO User_Y" in the Trigger:
--> my Trigger ist invalid (error = ora-04098)
When I declare a varchar-Variable within the trigger, fill it with:
"GRANT Role_X TO User_Y" and then : "EXECUTE IMMEDIATE <variable>"
--> my Trigger is valid, but when it fires I get the error:
ora-04092 - cannot COMMIT in a Trigger

Can anybody help me ?
Is it anyhow possible to GRANT a ROLE after inserting a record ?

Thanks in advance for any help or comments
Ralf
Jul 19 '05 #1
2 6054
You could do
1. Autonomous transaction
2. queue it up in dbms_job.

Why would you want to grant a role in a trigger?
Jim

"Ralf" <Mi**@boehrer.de> wrote in message
news:fa**************************@posting.google.c om...
Hi !

When I insert a new record to a table "table_A" I want to Grant a Role
"Role_X" to the User "User_Y".

So I made a Trigger who should do this work, but it doesn't:

When I write: "GRANT Role_X TO User_Y" in the Trigger:
--> my Trigger ist invalid (error = ora-04098)
When I declare a varchar-Variable within the trigger, fill it with:
"GRANT Role_X TO User_Y" and then : "EXECUTE IMMEDIATE <variable>"
--> my Trigger is valid, but when it fires I get the error:
ora-04092 - cannot COMMIT in a Trigger

Can anybody help me ?
Is it anyhow possible to GRANT a ROLE after inserting a record ?

Thanks in advance for any help or comments
Ralf

Jul 19 '05 #2
Hi Jim,

thanks for your answer.

I want to grant a role in a trigger beacuse of this reason:
I have a database-application in Oracle.
I use an own SCHEMA-Table which owns every oracle-schema my
application is working with (within these schemas there a tables with
datas).
Then I have a USER-Table to manage these users (part of all
Oracle-Users) who have the right to join my application.

Now I want to assign user X to schema Y. So that X can work with the
datas in Y.

For this reason I created a Role which give permission to all tables
in Y.
What I want now is, when assigning user X to schema Y (this inserts a
new
record in my user2schema-table), then the 'y_role' should be granted
to user x.

I'm not sure if this approach is ok or corrupt ?

Best regards
Ralf
"Jim Kennedy" <kennedy-down_with_spammers@no_spam.comcast.net> wrote in message news:<4wZVa.23596$YN5.21747@sccrnsc01>...
You could do
1. Autonomous transaction
2. queue it up in dbms_job.

Why would you want to grant a role in a trigger?
Jim

Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Andreas Falck | last post by:
Hi, I ran the code below on two different versions, 4.0.14 and 4.0.16 respectively, both running RH 7.3 on intel. In version mysql server version 4.0.14 the SELECT privelege suffices for...
7
by: Christopher Murtagh | last post by:
Greetings, I just had to dump and restore one of my DBs (7.4RC2), and I got an interesting message. I first did: pg_dump dbname > db_restore.sql Then at console did the following:
0
by: maersa | last post by:
Hi all, i'm serializing an arraylist like the following with an "Role" object as it's item. ----------------------------------------------------- ---- ArrayList ar = new ArrayList();...
2
by: Ellen Manning | last post by:
Using A2K. In my table I have the field "Grant" which can have a value or be null. I have a query that counts the number of records and has a Where clause on the Grant field. The query won't...
5
by: Kamil Tezduyar | last post by:
I want to create a team to develop a web portal framework. The main purpose of this framework is reusing this in many projects. The major idea in my mind it, building it as much as flexible. We...
1
by: Harold Hsu | last post by:
Hi, Originally, I have defined the following Enum within a namespace (outside a class): Public Enum UserRole Admin Manager User End Enum
1
by: edwige | last post by:
I just installed PostgreSQL on ubuntu linux. the installer does everything for, but I try to use "createuser" I get this message: { FATAL: role "root" does not exist } I have tried different...
9
by: =?Utf-8?B?QW1tZXI=?= | last post by:
I've read many incomplete opinions about the "Best Practice" for securely accessing SQL but what I really need to find the "Best Practice" that fits my applications needs. Currently (alpha...
2
by: Calvin Cheng | last post by:
Hi, I am attempting to convert a bunch of .txt files into html using the docutils package. It works for most of the txt files except for the index.txt file which gives 2 errors: (1)...
5
by: Cirene | last post by:
I just deployed my new ASP.NET (3.5 FW) site to the hosting company I'm using, webhost4life. NOTE: I HAVE deployed other SQL Server sites to the same account with no issues. Now I'm getting...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.