Home » SQL & PL/SQL » SQL & PL/SQL » How to make a trigger on the table for the history table (Oracle 12c Release 2)
How to make a trigger on the table for the history table [message #672823] Sun, 28 October 2018 13:50 Go to next message
petar97
Messages: 113
Registered: October 2018
Senior Member
I have problems creating trigger, after update, after insert and before delete.


Table accounts:

create table accounts (

acc_id number,
acc_name varchar2(32),
acc_amount number,
acc_date date
);

History table:

create table accounts_history (
id number
, old_name varchar2(32)
, new_name varchar2(32)
, old_amount number
, new_amount number
, change_date date
);


Re: How to make a trigger on the table for the history table [message #672824 is a reply to message #672823] Sun, 28 October 2018 14:14 Go to previous messageGo to next message
BlackSwan
Messages: 26564
Registered: January 2009
Location: SoCal
Senior Member
http://www.orafaq.com/forum/mv/msg/205220/672808/#msg_672808

PROBLEMS?
What problems?
I don't see any problems.

the posted "history" won't tell you who made the change (in a multi-user environment).

From where does ACCOUNTS_HISTORY.ID get its value?

unwilling or incapable to use GOOGLE yourself?
Re: How to make a trigger on the table for the history table [message #672825 is a reply to message #672823] Sun, 28 October 2018 14:21 Go to previous messageGo to next message
Michel Cadot
Messages: 66471
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

We are still waiting for your feedback in your previous topic.
You still don't format your post.

[Updated on: Sun, 28 October 2018 14:21]

Report message to a moderator

Re: How to make a trigger on the table for the history table [message #672826 is a reply to message #672825] Sun, 28 October 2018 14:36 Go to previous messageGo to next message
petar97
Messages: 113
Registered: October 2018
Senior Member
I have solved this problem with the package
Re: How to make a trigger on the table for the history table [message #672827 is a reply to message #672826] Sun, 28 October 2018 14:38 Go to previous messageGo to next message
BlackSwan
Messages: 26564
Registered: January 2009
Location: SoCal
Senior Member
Below is #12 from Posting Guidelines!
If you found an answer yourself, post it. That way we know the issue is resolved and we might learn from it.
Re: How to make a trigger on the table for the history table [message #672830 is a reply to message #672827] Sun, 28 October 2018 14:49 Go to previous messageGo to next message
petar97
Messages: 113
Registered: October 2018
Senior Member
okay, I'll publish how I've solved the problem

Now i have this problem, how to create trigger for after update
Re: How to make a trigger on the table for the history table [message #672833 is a reply to message #672830] Sun, 28 October 2018 14:53 Go to previous messageGo to next message
BlackSwan
Messages: 26564
Registered: January 2009
Location: SoCal
Senior Member
petar97 wrote on Sun, 28 October 2018 12:49
okay, I'll publish how I've solved the problem

Now i have this problem, how to create trigger for after update
PROBLEM?
What problem?
I don't see any problem.

I have a problem in making my car go.
Tell me how to make my car go.
Re: How to make a trigger on the table for the history table [message #672836 is a reply to message #672830] Sun, 28 October 2018 14:57 Go to previous message
Michel Cadot
Messages: 66471
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Quote:
Now i have this problem

No it is not, it is wrong.

Quote:
how to create trigger for after update
CREATE TRIGGER


Previous Topic: How to tune Query on Large Oracle Table
Next Topic: Who deleted the data
Goto Forum:
  


Current Time: Thu Jul 18 15:04:30 CDT 2019