checking the tables...
Hi Experts,Could someone help me with the following problem.
We strive to implement the function of 'check' on a table. What is the best way to do audits? (keep track of any changes in the table)
That's what we do...
Main_table
id
first_name
last_name
dob
hire_date
created_date
created_by
updated_date
updated_by
audit_table
ad_action (whether it is insert,update or delete)
ad_time (time)
ad_user (whos is the user)
id
first_name
last_name
dob
hire_date
created_date
created_by
updated_date
updated_by
and i have a trigger on the "main_table" like this
CREATE OR REPLACE TRIGGER Main_table_AIUD after
insert or update or delete on Main_table for each row
begin
declare
ljn_action varchar2(3);
begin
if inserting then
ljn_action := 'INS';
elsif updating then
ljn_action := 'UPD';
else
ljn_action := 'DEL';
end if;
--
if inserting then
insert into audit_table
(
ad_action,
ad_time,
ad_user,
id
first_name
last_name
dob
hire_date
created_date
created_by
updated_date
updated_by
)
values
(
ljn_action
,sysdate
,nvl(v('APP_USER') ,USER)
:new.id,
:new.first_name,
:new.last_name,
:new.dob,
:new.hire_date,
:new.created_date,
:new.created_by,
:new.updated_date,
:new.updated_by
);
elsif updating then
insert into audit_table
(
ad_action,
ad_time,
ad_user,
id
first_name
last_name
dob
hire_date
created_date
created_by
updated_date
updated_by
)
values
(
ljn_action
,sysdate
,nvl(v('APP_USER') ,USER)
:old.id,
:old.first_name,
:old.last_name,
:old.dob,
:old.hire_date,
:old.created_date,
:old.created_by,
:old.updated_date,
:new.updated_by
);
else
insert into audit_table
(
ad_action,
ad_time,
ad_user,
id
first_name
last_name
dob
hire_date
created_date
created_by
updated_date
updated_by
)
values
(
ljn_action
,sysdate
,nvl(v('APP_USER') ,USER)
:old.id,
:old.first_name,
:old.last_name,
:old.dob,
:old.hire_date,
:old.created_date,
:old.created_by,
:old.updated_date,
:new.updated_by
);
end if;
end;
end;
/
For "Insert" and "Delete" as I need to enter all parts of my code would be ok.But for "update" How can I capture only the columns that have changed? and put it in the audit table
so next time if I go to the audit table, I see clearly that these elements had changes.
Is there a better way to do it?
Please let me know
Thank you
Marella Phani wrote:
(3) if it is an action "update" on a table. How do we know the data of 'old' and 'new data' in the audit tables?
It is value according to the audit. And like many, I know, unfortunately, the only way to do so far is triggers.
Tags: Database
Similar Questions
-
How to check the table have are all views in oracle
Hello
How to check the table have are all views in oracleSELECT * FROM user_dependencies WHERE type='VIEW' AND referenced_type='TABLE' AND referenced_name ='Your_Table_Name'
You can use dba_dependencies to find views in the different schema.
-
Hello
I use Oracle R12.
Is oracle's hold no audit tables to track every transaction through EBS. For example, if I delete a folder of contacts using the Oracle table seeds API and validation, then it is not only the data but also the details of the transaction is completely lost.
My requirement is that I need to check the changes that happened in some paintings, whether create, update or delete transactions.
Is this possible? Is Oracle any method to achieve this?
Thank you
Anoop
The audit is closed as default. You can open it to a user or users, or any database, but you should consider the number of rows will be inserted by the audit of the process. You may have too many lines according to your amount of the transaction.
http://www.Oracle-base.com/articles/10G/auditing-10gR2.php
Concerning
-
How to check the table of organization
Hi all
How can we check the Organization of a table and more knowing that at the time of the creation of the TABLE, as we do for the external ORGANIZATION EXTERNAL tables.
Thank youuser13332773 wrote:
Hi allHow can we check the Organization of a table and more knowing that at the time of the creation of the TABLE, as we do for the external ORGANIZATION EXTERNAL tables.
Thank you
select * from dba_tables where iot_type = 'IOT'
-
How to check the table (null / not null) on the screen?
Hello all :)
I am beginner in JDEV
I have problem with table.
When you view the table, I want to know if the existing data in the table are empty or not (check the query zero / non-zero)? How to do
someone help me... :))
THX
agungdmtHello
If you use ADF BC, access the iterator and call getEstimatedRowCound
Table richeTableau = get JSF component binding to table
TableBinding JUCtrlHierBinding = (JUCtrlHierBinding) (table.getValue ()) .getWrappedData ((CollectionModel));
DCIteratorBinding iter = tableBinding.getIteratorBinding ();int count = iter.getEstimatedRowCount ();
You can do the same thing in EL
#{bindings.iteratorName.estimatedRowCount > 0}--> true if given
Frank
-
How to check the table reused in oracle 10g space?
Hello..
Of my system, I see table size keep growing event the deletion request is running. Because of this, I would like to check either the allowed oracle to reuse space table or not? If not then how can I enable it?
Please help me...
Thank you
BalleurYou can use dbms_space.space_usage to check for free space.
Reuse of the space will depend on whether you use MSSM or SAMS, PCT_FREE, PCT_USED and the way in which new data is inserted?
You can reduce or move the table and rebuild the index to reclaim space.
-
Is it possible to check the tables (HSQLDB) DB of JSK?
Hello
I want to inspect the tables of the catalog caching, SiteCatalog and element... Is this possible with JSK?
You can run the HSQLDB Editor
Java - cp hsqldb.jar org.hsqldb.util.DatabaseManagerSwing - urlid mem
In JSK hsqldb.jar file Jar is located in the folder lib tomcast (apache-tomcat-7.0.32\Sites\lib)
-
check the table to see if all the conditions are met.
Hello
I want to see if all my items in my table have hit an area on the stage and got a bit doing wrong.
the following code works:
If (ball1.hitTestObject (Box) & & ball2.hitTestObject (box) & & ball3.hitTestObject (box)) {}
trace ("Completed");
}
However, my goal is to have these movieClips stored in a table and would still like to call the hitTestFunction and AFTER THAT each item has hit the area to trigger an action, like that I could just add however items I want and keep the same line of code. Obviously if I set the table in a loop and assign [i], it's just going to join this element and the trigger, and I "m thinking that each property on the table could work it is just a matter of implementing a function to capture the right information. I hope this makes sense, and I appreciate your help.
Try this. Loop breaks when it is not hit - so a single object success will leave false hit test.
var ballsArray:Array = [ball1, ball2, ball3]; function checkHits():void { var isAllHit:Boolean = false; for each(var ball:Sprite in ballsArray) { isAllHit = ball.hitTestObject(box); if (!isAllHit) { break; } } trace("all hit?", isAllHit); }
-
Check the table in its entirety for collision? How? AS 2.0
Hello!
I make a flash game with Actionscript 2.0 and that you have encountered a problem.
I have this _root.bulletArray = [] statement that stores all my clips that have been created with attachMovieClip. I was able to store all the balls in the table because when I say that it trace the table I get the following text:
_level0.bulletCopy39
_level0.bulletCopy39, _level0.bulletCopy43
_level0.bulletCopy39, _level0.bulletCopy43, _level0.bulletCopy47
_level0.bulletCopy39, _level0.bulletCopy43, _level0.bulletCopy47, _level0.bulletCopy51
_level0.bulletCopy39, _level0.bulletCopy43, _level0.bulletCopy47, _level0.bulletCopy51, 0.bulletCopy55 _level
_level0.bulletCopy39, _level0.bulletCopy43, _level0.bulletCopy47, _level0.bulletCopy51, 0.bulletCopy55, _level0.bulletCopy59 _level
_level0.bulletCopy39, _level0.bulletCopy43, _level0.bulletCopy47, _level0.bulletCopy51, 0.bulletCopy55, _level0.bulletCopy59, _level0.bulletCopy63 _leveland etc...
But how to detecting the collision with ALL the balls?
I have a movieclip that bears the name of the instance: enemy
I wrote the following:
If (_root.bulletArray.HitTest (_root. Enemy))
{
trace ("hit")
}
It dosent work, notihing is traced in the command thing.
But if I do the following:
if(_root.bulletArray[1].) HitTest (_root. Enemy))
{
trace ("hit")
}
then it will detect the collision, but only of this ball, not the range of the bullets.
Any help is very appreciated! = D
-NOTE-
I also tried the followign without success:
If (_root.bulletArray [1,2,3,4,5,6,7,8,9,10]. HitTest (_root. Enemy))
{
trace ("hit")
}
You must use a loop to go through the element of a table in its entirety at a time...
for (i =; I
If (_root.bulletArray [i]. HitTest (_root. Enemy))
{
trace ("hit")
}
}
-
Hello community, I have a problem when creating a function. The purpose of this function is to check the table of weather gave yesterday or not. We must check this on different tables on different sachems. We are creating a function with input variables.
CREATE OR REPLACE FUNCTION IN_SCHEMA.IS_YDAYDATA_TO_TABLE
(
in_schema IN VARCHAR2,
in_tablename IN VARCHAR2,
in_datefield IN VARCHAR2,
)
RETURNS INTEGER
AS
-Declaring variables
v_is_true INTEGER.
BEGIN
SELECT
CASE
WHEN MAX (in_datefield) = TRUNC(SYSDATE-1)
THEN 1
ON THE OTHER
0
END
IN
v_is_true
Of
in_schema.in_tablename
;
RETURN v_is_true;
END;
/
When creating, I got error: [error] ORA-00942 (44:19): PL/SQL: ORA-00942: table or view does not exist
How to use the values of the input variables on the table select statement names?
Hello
Here's a way you can use dynamic SQL statements for this task:
CREATE OR REPLACE FUNCTION IS_YDAYDATA_TO_TABLE
(
in_schema IN VARCHAR2,
in_tablename IN VARCHAR2,
in_datefield IN VARCHAR2,
in_first_date DATE DEFAULT SYSDATE - 1,.
in_last_date DATE by DEFAULT NULL
)
RETURNS INTEGER
AS
-IS_YDAYDATA_TO_TABLE returns 1 if in_schema.in_tablename.in_datefield
-contains all the dates in the in_first_date of the range through included in_last_date
- and it returns 0 if there is no such lines.
-If in_last_date is omitted, the search only the data on in_first_date.
-If in_first_date is omitted, it defaults to yesterday.
-Time parts of the in_first_date and in_last_date are ignored.
-Declaring variables
sql_txt VARCHAR2 (1000);
v_is_true INTEGER.
BEGIN
sql_txt: = 'SELECT COUNT (*).
|| 'FROM ' | in_schema | '.' || in_tablename
|| 'WHERE ' | in_datefield | ' > =: d1'
|| «AND» | in_datefield | '< > >
|| 'AND ROWNUM = 1';
dbms_output.put_line (sql_txt |) '= sql_txt in IS_YDAYDATA_TO_TABLE"); -For debugging
Sql_txt EXECUTE IMMEDIATE
IN v_is_true
With the HELP of TRUNC (in_first_date) - d1
TRUNC (NVL (in_last_date
in_first_date
)
) + 1 -- d2
;
RETURN v_is_true;
END is_ydaydata_to_table;
/
DISPLAY ERRORS
If you must use dynamic SQL statements, put all the SQL statement in a single string variable, such as sql_txt in the example above. In this way, you can easily see exactly what will be executed. Comment out the call to dbms_output under test is completed.
Try to write functions that will address not only the question that you have now, but similar questions that you may have in the future. For example, now that interest you only to the verification of the data of yesterday, but later, you might want to check another day or range of days. The above function combines the convenience of a function simple (looks like yesterday data if you don't tell him otherwise) with the power of a more complex function (you can use the same function to check any day or range of days).
-
Orthographic inDesign - ignoring the reference numbers in the tables
I have a document of 100 pages with several tables. Each table contains many numbers of different parts, some letters including and others do not. We do not have any specific format. Is it possible that I can get the spell check to ignore any word that contains a number in my entire document? I want to still come out check to check the tables because there are other things other than the numbers of room inside. I tried using GREP styles to achieve this, but I can't make it work. Help, please!
Create a character style that affects the Language of No attribute and apply it to part numbers (use a find/replace query to find them). Does not take into account no. language spell check words.
-
No data in the tables after migration
I'm migrating from SQL Server to Oracle database using using SQL Developer - and all though until I checked the tables, and there is no data.
Log in as the new schema and don't "select count (*) from user_tables.
Got 35 tables, but when I checked the individual tables, there is no line (data).
Any suggestion?
Server: Windows 2008
Oracle 11g
SQL Server 2005This remark may help:
http://St-curriculum.Oracle.com/OBE/DB/hol08/sqldev_migration/MSSQLServer/migrate_microsoft_sqlserver_otn.htm
OR
http://www.Oracle.com/technetwork/database/migration/SQLServer-095136.html
Best regards
mseberg
-
Text disappears by updating the table of contents
I work with documents several pages that have been created by someone else in CS3 and then I convert it into CS5. Several times when I tried to update the table of contents, all text in the document disappears. All the objects to hold their positions and nothing else changes except that there is no visible text. I checked the table of contents style settings and can find no difference between a document that updates correctly and which don't. Around her, the only way is to copy and paste the content into a new document. This does not happen with all documents, only about 30%.
Text disappearing when you update a table of contents is usually a symtom of havint put the table of contents in the main story line. The table of contents must be in a separate story, no wire to anything, because the update replaces the whole story.
-
How imp one table, delete the old data? or the deletion of the table (before)
Suppose that: in my tcomven of the actual table, I have 15 records, guess also, I have the file: h12292008.dmp there are 27 records
If I type:
IMP TABLES = (tcomven) UFIERROS/linuxx fromuser = UFIERROS touser = UFIERROS file = h12292008.dmp ignore = Y
show imported 27 files, I checked the table and I have 15 + 27 files = 42 Records
My question:
before you import the table is possible delte all the contents of the Tcomven table (note I do first with sqlpleu and or sqldeveloper) my question is exista flag custom imp?
or:
If I type (same command ignore without flag):
IMP TABLES = (tcomven) UFIERROS/linuxx fromuser = UFIERROS touser = UFIERROS file = h12292008.dmp
tells me an error: the object exists, same question: the imp command flag for gout have first of all the tcomven of the table (or in any case, at the head of exp e)?
Thank youYour needs:
When you use imp (old style) of command line... you must delete/truncate the table before
If you are using expdp/impdp, there option TABLE_EXISTS_ACTION help 'TRUNCATE' table before.
TABLE_EXISTS_ACTION Action to perform if any object already exists.
Valid keywords: (SKIP), APPEND, REPLACE and TRUNCATE.
-
Check if the table contains a value
Hi all
I have a table in TestStand that contains numbers. Numbers are generated by a VI and are ranked randomly.
(1) how can I check to see if the number "6481" is in this table using a step of TestStand?
(2) is it possible to put this empty table in TestStand, and then complete the table to the size needed when the VI move back the numbers. (i.e. do the table to the size that the VI generates during execution)?
See you soon,.
Chase
I think you will be interested in this Jürgen!
I managed to do it in 'one step', using a loop.
Maybe you are looking for
-
A link button to submit a transaction on the site of a major Canadian Bank web page does not appear in the rendering of Firefox, but it does in the latest version of Safari. Support staff of the Bank claim that the problem is with javascript and I 's
-
Laptop HP 2000: password administrator or power on password
Hello... I've been locked out of my pc... He asks me the administrator password or power on password. The code I get is 86534651. Can someone help me with this problem please?
-
Original title: getting copied songs and resumes somehow Because of the settings or something my music player has more than one entry for a song... so when I buy a song or download from my phone to the player so I'll finish with three entries... on a
-
How to send photos taken by webcam dell to the email address
Im having two problems (if you exclude being computer delayed!) I know not how to send photos and videos by email that ive taken via my dell webcam, in addition, after using the webcam, ive fidddled with assistance or something because the screen is
-
Windows XP and Internet is Slow
Original title: reload xp benefits System slow @ start & on the Internet lately. Syst.Ask often send or not to micasoft Deleted cookies temp files Check the disk Defragment Run speedypc to clear the registry no noise suddenly System. found new H/W ha