Discussions
Categories
- 197.1K All Categories
- 2.5K Data
- 546 Big Data Appliance
- 1.9K Data Science
- 450.7K Databases
- 221.9K General Database Discussions
- 3.8K Java and JavaScript in the Database
- 31 Multilingual Engine
- 552 MySQL Community Space
- 479 NoSQL Database
- 7.9K Oracle Database Express Edition (XE)
- 3.1K ORDS, SODA & JSON in the Database
- 555 SQLcl
- 4K SQL Developer Data Modeler
- 187.2K SQL & PL/SQL
- 21.3K SQL Developer
- 296.3K Development
- 17 Developer Projects
- 139 Programming Languages
- 293K Development Tools
- 110 DevOps
- 3.1K QA/Testing
- 646.1K Java
- 28 Java Learning Subscription
- 37K Database Connectivity
- 158 Java Community Process
- 105 Java 25
- 22.1K Java APIs
- 138.2K Java Development Tools
- 165.3K Java EE (Java Enterprise Edition)
- 19 Java Essentials
- 162 Java 8 Questions
- 86K Java Programming
- 81 Java Puzzle Ball
- 65.1K New To Java
- 1.7K Training / Learning / Certification
- 13.8K Java HotSpot Virtual Machine
- 94.3K Java SE
- 13.8K Java Security
- 205 Java User Groups
- 24 JavaScript - Nashorn
- Programs
- 468 LiveLabs
- 39 Workshops
- 10.2K Software
- 6.7K Berkeley DB Family
- 3.5K JHeadstart
- 5.7K Other Languages
- 2.3K Chinese
- 175 Deutsche Oracle Community
- 1.1K Español
- 1.9K Japanese
- 233 Portuguese
Getting USER that made an insert query with a trigger

so i have trigger that fires before an insert quuery , how can i get the USER that made the insert query ?
Answers
-
Hi,
4143087 wrote:so i have trigger that fires before an insert quuery , how can i get the USER that made the insert query ?
The USER function returns the Oracle user name.
Some applications manage their own users: everyone connects using a generic Oracle user, then authenticates in some application-specific way. If you're application is like that, then ask someone familiar with your application.
-
4143087 wrote:so i have trigger that fires before an insert quuery , how can i get the USER that made the insert query ?
What exactly do you desire to obtain?
Is your application implemented like below?
EndUser<=>browser<=>webserver<=>ApplicationServer<=>DatabaseServer
-
no , i have homework in pl/sql :
i have these tables :
-- OUVRAGE(IDO,TITRE,ANNEE,THEME,LIKES,DISLIKES)
-- COPIE(IDC,ETAT,IDO#)
-- ETUDIANT(IDE,CIN,NOM,CURSUS)
-- PRET(IDC#,IDE#,DATEP,DATER,AVIS,IDB#)
-- BIBLIO(IDB,NOM)
I have 3 users
so it asks to create a trigger that launchs before an insert query in the table PRET , the trigger should update ETAT in table PRET and also to read the name of user who made that insert query ..
-
4143087 wrote:no , i have homework in pl/sql :i have these tables : -- OUVRAGE(IDO,TITRE,ANNEE,THEME,LIKES,DISLIKES)-- COPIE(IDC,ETAT,IDO#)-- ETUDIANT(IDE,CIN,NOM,CURSUS)-- PRET(IDC#,IDE#,DATEP,DATER,AVIS,IDB#)-- BIBLIO(IDB,NOM)I have 3 users so it asks to create a trigger that launchs before an insert query in the table PRET , the trigger should update ETAT in table PRET and also to read the name of user who made that insert query ..
YOu should have stated up front that it was a homework assignment.
So, being a homework, we can ignore the fact that the specific use of the trigger might very well be worthless in a real production enviornment (take note for when you ARE working in a real production environment) and focus on the technique.
And, being homework, we would very much expect to see what you've tried for yourself and your explanation of what is wrong with what you have so far. You gain nothing by having someone else do your homework for you.
-
Homework questions are not a problem. However, we do require you to post what you have tried
If you need a database to use to test on, http://LiveSQL.oracle.com would be one you can access through a web browser (and only a web browser)
------
I suggest you start with an example code and modify it to fit your needs.
The Fine Manual would be a good place to start.
Forgive me for posting the link to v7 when v20 will be out soon.
https://docs.oracle.com/cd/A57673_01/DOC/dcommon/oin/index.htm
I doubt the syntax has changed much.
MK
-
4143087 wrote:no , i have homework in pl/sql :i have these tables : -- OUVRAGE(IDO,TITRE,ANNEE,THEME,LIKES,DISLIKES)-- COPIE(IDC,ETAT,IDO#)-- ETUDIANT(IDE,CIN,NOM,CURSUS)-- PRET(IDC#,IDE#,DATEP,DATER,AVIS,IDB#)-- BIBLIO(IDB,NOM)I have 3 users so it asks to create a trigger that launchs before an insert query in the table PRET , the trigger should update ETAT in table PRET and also to read the name of user who made that insert query ..
Please NOTE that the PRET table does NOT contain any ETAT column; so either wrong table or wrong column.
But some is WRONG with the requirements statement.
Along this line, please clarify into which table & column the USER name needs to be INSERTED
Please click on URL below & provide details as stated in #5 - #9 inclusive
How do I ask a question on the forums?