Creating Audit Data with Triggers

I want to create an audit table like
AuditTable(
FieldName Varchar2(40),
OldValue Varchar2(100),
NewValue Varchar2(100),
User varchar2(20),
UpdtDate Date)
Whenever Table X is updated, then the Trigger should capture the changes and create a row for each field in the UPdate Statement.
I don't want to turn on Audit as the DB is very big and high transaction oriented. I just want to watch a particulare table only.
I need a little guidance in parsing the update statement and get the fieldnames, their old values and new values.

Well, you could certainly audit a single table - you don't have to audit every table.
In any case, the trigger would look something like:
create or replace trigger t_audit
after update on t
for each row
begin
  if updating('column_a') then
    insert into audittable values ('column_a', :old.column_a, :new.column_a, user, sysdate);
  end if;
  ... repeat for all columns
  if updating('column_z') then
    insert into audittable values ('column_z', :old.column_z, :new.column_z, user, sysdate);
  end if;
end;You can use the data dictionary (user_tab_columns) to automate the writing of that trigger if there are many columns.

Similar Messages

  • Creating legacy data with AS91 problem

    Hi all,
    We found an old laptop and we just want to trace it. It wonu2019t have a value. So I am trying to create legacy data with AS91 transaction code, after the input Asset Class and Company Code, following error code appears on the screen:
    Closed fiscal year does not agree with legacy data transfer date
         Message no. AC199
        Diagnosis
         The closed fiscal year 2010 does not agree with transfer date 21.12.2008
         If you wish to carry out a transfer within the fiscal year, the date of the legacy data transfer has to be in the year following the closed fiscal year.
         Example: Transfer date July 1, 1993; closed fiscal year 1992 In any other cases the transfer date has to be the last day of the last closed fiscal year.
         Example: Transfer date December 31, 1993; closed fiscal year
         Procedure
         Correct your entry.
    I know that I can change the FI-AA Date of Legacy Data Transfer but I donu2019t want to change it because I donu2019t know where will be affected if I change the date. Is there any other solution for this?
    Thanks for all.

    Hi,
    Some fields can be made optional for input.
    First: check in customizing (transaction OAOA) which screen layout rule is assigned to the required asset class.
    Second: go in customizing to Asset Accounting / Master Data / Screen Layout / Define Screen Layout for Asset Master Data. Select the screen layout you found in the 1st step.
    Double-click Logical field groups.
    Select 2 Posting information.
    Double-click Field group rules.
    Set the required field on optional (or required - whichever suits you best). Select Main number and/or Sub number for these fields.
    The field Acquisition date will only be filled with a date from an actual posting you'll make on the asset. Since you won't have any values on the asset, this field will remain empty. It is not possible to define this field as optional or required in the screen layout settings.
    Kind regards,
    Andre

  • Audit Vault 12.1.1 error creating audit trail with TRANSACTION LOG

    Hi,
    i installed AV 12.1.1 , the DB target is with Data Guard.
    when i run the script oracle_user_setup with the mode REDO_COLL the final message is that was succesfull , but when i go to the AV console and try to create an audit trail with TRANSACTION LOG the AV console shows me an error and the log shows me this :
    [2013-10-16T03:37:18.593-05:00] [collfwk] [ERROR] [] [] [tid: 10] [ecid: 192.168.56.8:78800:1381912639433:0,0] RedoCollector : runSourceScript : Error while running script on source for REDO collector.
    [2013-10-16T03:37:19.528-05:00] [collfwk] [ERROR] [] [] [tid: 10] [ecid: 192.168.56.8:78800:1381912639433:0,0] OAV-8004: Failed to start collector {0}:{1}CollectionFactory : createCollection : Exception while creating collection. [[
    Failed to start collector {0}:{1}
                    at oracle.av.platform.agent.collfwk.impl.redo.RedoCollector.runSourceScript(RedoCollector.java:816)
                    at oracle.av.platform.agent.collfwk.impl.redo.RedoCollector.sourceSetup(RedoCollector.java:579)
                    at oracle.av.platform.agent.collfwk.impl.redo.RedoCollector.setup(RedoCollector.java:454)
                    at oracle.av.platform.agent.collfwk.impl.redo.RedoCollector.startCollector(RedoCollector.java:216)
                    at oracle.av.platform.agent.collfwk.impl.redo.RedoCollectorManager.startTrail(RedoCollectorManager.java:199)
                    at oracle.av.platform.agent.collfwk.impl.factory.CollectionFactory.createCollection(CollectionFactory.java:504)
                    at oracle.av.platform.agent.collfwk.impl.factory.CollectionFactory.createCollection(CollectionFactory.java:354)
                    at oracle.av.platform.agent.StartTrailCommandHandler.processMessage(StartTrailCommandHandler.java:63)
                    at oracle.av.platform.agent.AgentController.processMessage(AgentController.java:325)
                    at oracle.av.platform.agent.AgentController$MessageListenerThread.run(AgentController.java:1859)
                    at java.lang.Thread.run(Thread.java:679)
    Nested Exception:
    java.sql.SQLSyntaxErrorException: ORA-01031: insufficient privileges
    ORA-06512: at line 1
                    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:445)
                    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:396)
                    at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:879)
                    at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:450)
                    at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:192)
                    at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:531)
                    at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:207)
                    at oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:1044)
                    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1329)
                    at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3584)
                    at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3685)
                    at oracle.jdbc.driver.OraclePreparedStatementWrapper.execute(OraclePreparedStatementWrapper.java:1376)
                    at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
                    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                    at java.lang.reflect.Method.invoke(Method.java:616)
                    at oracle.ucp.jdbc.proxy.StatementProxyFactory.invoke(StatementProxyFactory.java:230)
                    at oracle.ucp.jdbc.proxy.PreparedStatementProxyFactory.invoke(PreparedStatementProxyFactory.java:124)
                    at $Proxy2.execute(Unknown Source)
                    at oracle.av.platform.agent.collfwk.impl.redo.RedoCollector.runSourceScript(RedoCollector.java:747)
                    at oracle.av.platform.agent.collfwk.impl.redo.RedoCollector.sourceSetup(RedoCollector.java:579)
                    at oracle.av.platform.agent.collfwk.impl.redo.RedoCollector.setup(RedoCollector.java:454)
                    at oracle.av.platform.agent.collfwk.impl.redo.RedoCollector.startCollector(RedoCollector.java:216)
                    at oracle.av.platform.agent.collfwk.impl.redo.RedoCollectorManager.startTrail(RedoCollectorManager.java:199)
                    at oracle.av.platform.agent.collfwk.impl.factory.CollectionFactory.createCollection(CollectionFactory.java:504)
                    at oracle.av.platform.agent.collfwk.impl.factory.CollectionFactory.createCollection(CollectionFactory.java:354)
                    at oracle.av.platform.agent.StartTrailCommandHandler.processMessage(StartTrailCommandHandler.java:63)
                    at oracle.av.platform.agent.AgentController.processMessage(AgentController.java:325)
                    at oracle.av.platform.agent.AgentController$MessageListenerThread.run(AgentController.java:1859)
                    at java.lang.Thread.run(Thread.java:679)
    i don't understand why the issue because the user has the privileges given by the script and i tried with grant as sysdba but without any result
    i don't understand what are the privileges that the collector needs.
    any idea?
    thnks for any help

    Hi
    Just run the script $AV_AGENT/av/plugins/com.oracle.av.plugin.oracle/config/oracle_user_setup.sql  USER_NAME REDO_COLL
    This will grant the user some privileges and roles like DBA and CREATE Database Link
    I hope this answer your question
    Thanks
    Ahmed Moustafa

  • OAV-9016 - Audit Vault 12.1.1 error creating audit trail with TRANSACTION LOG

    Hey guys,
    I bumped into this problem when trying to start an audit trail with TRANSACTION LOG.
    Oracle Audit Vault and Database Firewall 12.1.1.1
    Oracle 11gR2 RAC two nodes, OEL x64.
    Connection String:
    jdbc:oracle:thin:@//192.168.1.139:1521/orcl
    I have already ran the sql setup for a REDO_COLL user.
    Any ideas?
    I have created secure target for each node.
    (host01)(oracle@orcl1):log> pwd
    /u01/app/oracle/agent/av/log
    (host01)(oracle@orcl1):log> cat av.collfwk-8311-0.log
    [2013-12-12T17:16:49.855-02:00] [collfwk] [ERROR] [] [] [tid: 22] [ecid: 192.168.1.109:27132:1386867392018:0,0] OAV-9016: Target database global_name is not correct. global_name must include the domain for transaction log collection. Please configure the target database with the correct global_name.CollectionFactory : createCollection : Exception while creating collection. [[
    Target database global_name is not correct. global_name must include the domain for transaction log collection. Please configure the target database with the correct global_name.
            at oracle.av.platform.agent.collfwk.impl.redo.RedoCollector.checkDBName(RedoCollector.java:1480)
            at oracle.av.platform.agent.collfwk.impl.redo.RedoCollector.verifySource(RedoCollector.java:1278)
            at oracle.av.platform.agent.collfwk.impl.redo.RedoCollector.startCollector(RedoCollector.java:215)
            at oracle.av.platform.agent.collfwk.impl.redo.RedoCollectorManager.startTrail(RedoCollectorManager.java:199)
            at oracle.av.platform.agent.collfwk.impl.factory.CollectionFactory.createCollection(CollectionFactory.java:504)
            at oracle.av.platform.agent.collfwk.impl.factory.CollectionFactory.createCollection(CollectionFactory.java:354)
            at oracle.av.platform.agent.StartTrailCommandHandler.processMessage(StartTrailCommandHandler.java:63)
            at oracle.av.platform.agent.AgentController.processMessage(AgentController.java:325)
            at oracle.av.platform.agent.AgentController$MessageListenerThread.run(AgentController.java:1859)
            at java.lang.Thread.run(Thread.java:722)
    (host01)(grid@+ASM1):~> lsnrctl status
    LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 12-DEC-2013 17:27:34
    Copyright (c) 1991, 2011, Oracle.  All rights reserved.
    Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))
    STATUS of the LISTENER
    Alias                     LISTENER
    Version                   TNSLSNR for Linux: Version 11.2.0.3.0 - Production
    Start Date                12-DEC-2013 16:58:03
    Uptime                    0 days 0 hr. 29 min. 31 sec
    Trace Level               off
    Security                  ON: Local OS Authentication
    SNMP                      OFF
    Listener Parameter File   /u01/app/11.2.0/grid/network/admin/listener.ora
    Listener Log File         /u01/app/grid/diag/tnslsnr/host01/listener/alert/log.xml
    Listening Endpoints Summary...
      (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
      (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.109)(PORT=1521)))
      (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.139)(PORT=1521)))
    Services Summary...
    Service "+ASM" has 1 instance(s).
      Instance "+ASM1", status READY, has 1 handler(s) for this service...
    Service "orcl" has 1 instance(s).
      Instance "orcl1", status READY, has 1 handler(s) for this service...
    Service "orclXDB" has 1 instance(s).
      Instance "orcl1", status READY, has 1 handler(s) for this service...
    The command completed successfully
    (host01)(grid@+ASM1):~>
    (host01)(grid@+ASM1):~> cat /u01/app/11.2.0/grid/network/admin/listener.ora
    LISTENER=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER))))            # line added by Agent
    LISTENER_SCAN3=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN3))))                # line added by Agent
    LISTENER_SCAN2=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN2))))                # line added by Agent
    LISTENER_SCAN1=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN1))))                # line added by Agent
    ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER_SCAN1=ON                # line added by Agent
    ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER_SCAN2=ON                # line added by Agent
    ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER_SCAN3=ON                # line added by Agent
    ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER=ON              # line added by Agent
    (host01)(grid@+ASM1):~>

    Hi
    Just run the script $AV_AGENT/av/plugins/com.oracle.av.plugin.oracle/config/oracle_user_setup.sql  USER_NAME REDO_COLL
    This will grant the user some privileges and roles like DBA and CREATE Database Link
    I hope this answer your question
    Thanks
    Ahmed Moustafa

  • Creating dunning data with Spool request

    Hi,
    I am working with Smartform,which is dunning Notices for Customer.It is configured in F150 Transaction.
    TO see Printout,need to have dunning data.
    Can you help me how to create Dunning data for customer.
    Thanks in Advance.
    Regards
    KB

    Which line is reported for the exception?

  • Create Master Data with leading zero

    Dear Expert,
    Our customer request to create Customer Master/Vendor Master/Material Master with leading zero. For example: they want to create Customer 0234578.
    I can do that for material, would you please advise how to do the same for customer/vendor?
    Thanks you,

    Dear Mr.
    Our customer number is in numeric, then this error happen. If customer number constants 1 char, then system will keep zero leading (ex: 012A4) But if customer number constants only numeric, even i type zero, system will remove leading zero.(01234 ==> 1234)
    Please help.

  • How to create CSV data with a cell including two rows?

    Hi guys,
    i am creating CSV using "comma" as seperator for columns, "return" as seperator for rows.
    But how can I create a cell which includes two rows?
    I want to do following:
    cell1    cell2    cell3
    XXXXX    YYYYY    ZZZZZ
    in cell2 YYYYY, there are two sub rows:
    YLine1.1     YLine1.2       YLine1.3                
    YLine2.1     YLine2.2       YLine2.3
    Which kind of seperator can I use for these sub rows?
    so to say(XML mode):
    <row>
      <Col1>XXXXX</Col1 >
      <Col2>
        <row>
    <col1>YLine1.1</col1>
    <col1>YLine1.2</col1>
    <col1>YLine1.3</col1>
    </row>
        <row>
    <col1>YLine2.1</col1>
    <col1>YLine2.2</col1>
    <col1>YLine2.3</col1>
    </row>
      </Col2 >
      <Col3>ZZZZZ</Col3 >
    </row>
    It is very kind of you to give me some hint!
    Regards,
    Liying
    Message was edited by:
            Liying Wang
    Message was edited by:
            Liying Wang

    Hi Wang Liying,
    I tried with Excel. A Cell with 2 rows saved as CSV shows that the cells contents are enclosed in hyphens "b row 2 b" and the two rows ins one cell are separated with HEX 0A. This is a simple Line feed. The sequence to build this would be in ABAP
    concatenate
    <row1>
    CL_ABAP_CHAR_UTILITIES=>NEWLINE
    <row2>
    into cell.
    I did not take the time to try on system, but I tried to open with excel: It works with Windows.
    Regards,
    Clemens

  • How to create a date object with a specific time?

    How can I create a date with today's date but with a specific time, say: 20:00:00?
    Thanks in advance.

    Don't forget about those pesky milliseconds!I'd have gotten away with it too.. if it hadn't been
    for that pesky BigDaddyLoveHandles.I'm in top form today. On the drive in to work I managed to
    push two scooter riders off the road and gave the finger to
    a Prius owner.

  • Creating Recovery Media with Portable External Hard Drive

    Is it possible to create recovery data with a portable external hard drive?

    Hi,
    i am also facing the same problem not able to create the recovery media in external hard disk. win 7 64 bit..
    Please help there is an option to create recovery media in USB flash drive but its not recognising the usb even though its connected.
    Mahesh

  • How to create audit triggers and run it dynamically?

    DECLARE
    V_CRT VARCHAR2(4000);
    V_DRP VARCHAR2(200);
    BEGIN
    FOR tab_rec IN (SELECT TABLE_NAME FROM USER_tabLES WHERE TABLE_NAME NOT LIKE '%TMP' AND TABLE_NAME NOT LIKE '%BAK' AND TABLE_NAME NOT LIKE 'MV_%') loop
    v_DRP := 'DROP TABLE AUD_'||tab_rec.tABLE_name ||';' || CHR(13);
    v_crt := ' CREATE TABLE AUD_'||tab_rec.tABLE_name
    ||'( ACTION VARCHAR2(1) ,
    CONSTRAINT AUD_'||SUBSTR(TAB_REC.TABLE_NAME, 1,11)||substr(tab_rec.table_name,length(tab_rec.table_name)-4,5)||'_CHKACTION CHECK (ACTION IN (''I'',''U'',''D'')),
    ISSUE_TIMESTAMP TIMESTAMP DEFAULT SYSDATE,
    ISSUE_USER VARCHAR2(30),
    ISSUE_HOST VARCHAR2(40),
    FOR col_rec IN (SELECT column_name,data_type,data_length,data_precision,data_scale FROM user_tab_cols WHERE table_name = tab_rec.table_name ORDER BY column_id)
    loop
    IF col_rec.data_type = 'VARCHAR2' THEN
    v_crt := v_crt || col_rec.column_name || ' '|| col_rec.data_type||'('||col_rec.data_length||'),'||chr(13)||' ';
    ELSIF col_rec.data_type = 'NUMBER' THEN
    v_crt := v_crt || col_rec.column_name || ' '||col_rec.data_type;
    IF col_rec.data_precision IS NOT NULL THEN
    v_crt:= v_crt||'('||col_rec.data_precision||','||col_rec.data_scale||'),'||chr(13)||' ';
    ELSE
    v_crt:= v_crt||','||chr(13)||' ';
    END IF;
    ELSE
    v_crt := v_crt || col_rec.column_name || ' '||col_rec.data_type||','||chr(13)||' ';
    END IF;
    END loop;
    v_crt := rtrim(v_crt);
    v_crt := substr(v_crt,1,LENGTH(v_crt)-2)||');';
    DBMS_OUTPUT.PUT_LINE(v_crt);
    v_crt:= '';
    END LOOP;
    END;
    The audit tables are named same as the table prefixed with AUD_. The audit table has two columns ACTION and ISSUE_TIMESTAMP more than the main tables.
    This anonymous block creates the triggers in the table which has audit tables dynamically.
    The user data is not maintained here in this code.
    This code runs.
    DECLARE
    v_output1 VARCHAR2(5000);
    v_insert VARCHAR2(4000);
    v_delete VARCHAR2(4000);
    v_update VARCHAR2(4000);
    v_cols VARCHAR2(1000);
    v_columns VARCHAR2(2000)DEFAULT '';
    v_columns_new VARCHAR2(2000) DEFAULT '';
    v_columns_old VARCHAR2(2000) DEFAULT '';
    v_tab1 VARCHAR2(30) DEFAULT ' ';
    v_tab2 VARCHAR2(30) DEFAULT ' ';
    v_tab3 VARCHAR2(30) DEFAULT ' ';
    v_schema varchar2(30) default 'schema'; --
    v_user_id VARCHAR2(30); -- not used in this program
    v_host VARCHAR2(30);
    BEGIN
    /* The audit tables are created with table name prefixed with AUD and columns ACTION AND ISSUE DATE, ISSUE_USER,ISSUE_HOST added.*/
    FOR rec IN
    (SELECT tname FROM tab WHERE tname LIKE 'AUD%'
    LOOP
    v_columns := '';
    v_columns_new := '';
    v_columns_old := '';
    v_output1 := 'CREATE OR REPLACE TRIGGER '
    ||v_schema||'.' ||rec.tname ||'_TRIG ' || chr(13)
    ||' AFTER ' || chr(13)
    ||' INSERT OR '|| chr(13)
    ||' UPDATE OR '|| chr(13)
    ||' DELETE ON '|| chr(13)
    ||v_schema||'.'
    || substr(rec.tname,5)
    || chr(13)
    ||' FOR EACH ROW '
    ||chr(13)
    ||' BEGIN ' || chr(13);
    FOR colrec IN
    (SELECT column_name
    FROM user_tab_cols
    WHERE table_name = rec.tname
    AND column_name NOT IN ('ACTION','ISSUE_TIMESTAMP','ISSUE_USER','ISSUE_HOST')
    LOOP
    v_columns := v_columns||v_tab3||colrec.column_name ||','||chr(13);
    v_columns_new := v_columns_new ||v_tab3||':new.'||colrec.column_name ||','||chr(13) ;
    v_columns_old := v_columns_old ||v_tab3||':old.'||colrec.column_name ||','||chr(13) ;
    END LOOP;
    v_columns := SUBSTR(v_columns ,1,LENGTH(v_columns ) -2);
    v_columns_new := SUBSTR(v_columns_new,1,LENGTH(v_columns_new)-2);
    v_columns_old := SUBSTR(v_columns_old,1,LENGTH(v_columns_old)-2);
    v_insert := v_tab1||'IF INSERTING THEN ' || chr(13)
    ||v_tab2||'INSERT INTO '||v_schema||'.' ||rec.tname|| chr(13)
    || v_tab2||' ( '||chr(13)
    || v_tab3||'ACTION,'||chr(13)
    || v_tab3||'ISSUE_TIMESTAMP,' ||chr(13)
    || v_tab3||'ISSUE_USER,'||chr(13)
    || v_tab3||'ISSUE_HOST,'||chr(13)
    ||v_columns ||chr(13) ||v_tab2||')' || chr(13)
    ||v_tab2||' VALUES ' ||chr(13)
    ||v_tab2||' (' ||chr(13)
    ||v_tab3||'''I'''||','||chr(13)
    ||v_tab3||'SYSTIMESTAMP'||','||chr(13)
    ||v_tab3||'USER'||','||chr(13)
    ||v_tab3||'sys_context('||'''USERENV'''||','||'''HOST'''||'),'||chr(13)
    ||v_columns_new ||v_tab2||');' ||chr(13)
    ||v_tab1||'END IF;'
    || CHR(13);
    v_delete := v_tab1||'IF DELETING THEN ' || chr(13)
    ||v_tab2||'INSERT INTO '||v_schema||'.' ||rec.tname|| chr(13)
    ||v_tab2|| '( '||chr(13)
    || v_tab3||'ACTION,'||chr(13)
    || v_tab3||'ISSUE_TIMESTAMP,' ||chr(13)
    || v_tab3||'ISSUE_USER,'||chr(13)
    || v_tab3||'ISSUE_HOST,'||chr(13)
    ||v_columns ||chr(13)
    ||v_tab2||')' || chr(13)
    ||v_tab2||' VALUES ' ||chr(13)
    ||v_tab2||' (' ||chr(13)
    ||v_tab3||'''D'''||','||chr(13)
    ||v_tab3||'SYSTIMESTAMP'||','||chr(13)
    ||v_tab3||'USER'||','||chr(13)
    ||v_tab3||'sys_context('||'''USERENV'''||','||'''HOST'''||'),'||chr(13)
    ||v_columns_old
    ||v_tab2||');' ||chr(13)
    ||v_tab1
    ||'END IF;' ||CHR(13);
    v_update := v_tab1||'IF UPDATING THEN ' || chr(13)
    ||v_tab2||'INSERT INTO '||v_schema||'.' ||rec.tname|| chr(13)
    ||v_tab2|| '( '||chr(13)
    ||v_tab3|| 'ACTION,'||chr(13)
    ||v_tab3|| 'ISSUE_TIMESTAMP,' ||chr(13)
    ||v_tab3||'ISSUE_USER,'||chr(13)
    ||v_tab3||'ISSUE_HOST,'||chr(13)
    ||v_columns ||chr(13)
    ||v_tab2||')' || chr(13)
    ||v_tab2||' VALUES ' ||chr(13)
    ||v_tab2||' (' ||chr(13)
    ||v_tab3||'''U'''||','||chr(13)
    ||v_tab3||'SYSTIMESTAMP'||','||chr(13)
    ||v_tab3||'USER'||','||chr(13)
    ||v_tab3||'sys_context('||'''USERENV'''||','||'''HOST'''||'),'||chr(13)
    ||v_columns_new
    ||v_tab2||');' ||chr(13)
    ||v_tab1||'END IF;'|| chr(13) ;
    -- v_output1 := v_output1 || v_insert || v_update|| v_delete ||CHR(13)||'END;';
    --EXECUTE IMMEDIATE v_output1;
    -- v_output1 := v_output1 || chr(13)||'/';
    dbms_output.put_line(v_output1); generate script
    dbms_output.put_line(v_output1);
    dbms_output.put_line(v_insert);
    dbms_output.put_line(v_update);
    dbms_output.put_line(v_delete);
    dbms_output.put_line('END;');
    dbms_output.put_line('/');
    END LOOP;
    END;
    show errors;
    Edited by: ranjus on Oct 17, 2012 3:33 PM

    Thank you so much for your suggestions.
    I went through the link you suggested.
    I wondered why DBA requested me to create triggers when such easy option was available to them. And I found the reason why triggers for audit.
    When Triggers Are Necessary
    Avoiding False Positives. Audit trails are generated through autonomous transactions from the original transactions. Hence they are committed even if the original transactions are rolled back.
    Here is a simple example to illustrate the point. Assume that we have set up auditing for UPDATEs on table CLASS. A user issues a statement to update a data value from 20 to 10 and then rolls it back as shown below.
    update class set size = 10 where class_id = 123;
    rollback
    Now the value of the column SIZE will be 20, not 10, as if the user never did anything. However, the audit trail will capture the change, even if it's rolled back. This may be undesirable in some cases, especially if there are lots of rollbacks by users. In such a case, you may have to use the trigger to capture only committed changes. If there were a trigger on the table CLASS to insert records into the user defined audit trail, upon rollback the audit trails would have been rolled back too
    Capturing Before-change Values. Oracle-provided audit trails do not show the values before and after the change. For instance, the above change will create an audit record that shows the statement and the SCN number at the change, but not the value before the change (20). The value can be obtained from the SCN number using flashback query, but it depends on the information being available in the undo segments. If the information is not captured within the limit specified by the undo_retention period, the prior values can never be retrieved. Using a trigger guarantees that the values are captured without dependence on the undo_retention period, and may prove useful at times. Under these two circumstances you may decide to continue using triggers to record the audit trails at a granular detail.

  • How to create a report with survey data

    Hi All,
    I need to create a report with survey data in below format. Can anyone help me how to display the summary in this format.
    Swapna

    Hi Swapna,
    According to your description, you want to create a report with survey data and display the summary.
    Reporting Services is used for rendering the report with data retrieved from datasource. In Reporting Services, we can retrieve data from the datasource then design a report, after the report processed, data is fixed on the report. So it’s not supported
    to have the end users selection and do summary. For your requirement, it’s can’t be achieved currently.
    If you have any question, please feel free to ask.
    Best regards,
    Qiuyun Yu
    Qiuyun Yu
    TechNet Community Support

  • How to create a report with data using the Crystal Reports for Java SDK

    Hi,
    How do I create a report with data that can be displayed via the Crystal Report for Java SDK and the Viewers API?
    I am writing my own report designer, and would like to use the Crystal Runtime Engine to display my report in DHTML, PDF, and Excel formats.  I can create my own report through the following code snippet:
    ReportClientDocument boReportClientDocument = new ReportClientDocument();
    boReportClientDocument.newDocument();
    However, I cannot find a way to add data elements to the report without specifying an RPT file.  Is this possible?  I seems like it is since the Eclipse Plug In allows you to specify your database parameters when creating an RPT file.
    is there a way to do this through these packages?
    com.crystaldecisions.sdk.occa.report.data
    com.crystaldecisions.sdk.occa.report.definition
    Am I forced to create a RPT file for the different table and column structures I have? 
    Thank you in advance for any insights.
    Ted Jenney

    Hi Rameez,
    After working through the example code some more, and doing some more research, I remain unable to populate a report with my own data and view the report in a browser.  I realize this is a long post, but there are multiple errors I am receiving, and these are the seemingly essential ones that I am hitting.
    Modeling the Sample code from Create_Report_From_Scratch.zip to add a database table, using the following code:
    <%@ page import="com.crystaldecisions.sdk.occa.report.application.*"%>
    <%@ page import="com.crystaldecisions.sdk.occa.report.data.*"%>
    <%@ page import="com.crystaldecisions.sdk.occa.report.document.*"%>
    <%@ page import="com.crystaldecisions.sdk.occa.report.definition.*"%>
    <%@ page import="com.crystaldecisions.sdk.occa.report.lib.*" %>
    <%@ page import = "com.crystaldecisions.report.web.viewer.*"%>
    <%
    try { 
                ReportClientDocument rcd = new ReportClientDocument();
                rcd.newDocument();
    // Setup the DB connection
                String database_dll = "Sqlsrv32.dll";
                String db = "qa_start_2012";
                String dsn = "SQL Server";
                String userName = "sa";
                String pwd = "sa";
                // Create the DB connection
                ConnectionInfo oConnectionInfo = new ConnectionInfo();
                PropertyBag oPropertyBag1 = oConnectionInfo.getAttributes();
                // Set new table logon properties
                PropertyBag oPropertyBag2 = new PropertyBag();
                oPropertyBag2.put("DSN", dsn);
                oPropertyBag2.put("Data Source", db);
                // Set the connection info objects members
                // 1. Pass the Logon Properties to the main PropertyBag
                // 2. Set the Server Description to the new **System DSN**
                oPropertyBag1.put(PropertyBagHelper.CONNINFO_CRQE_LOGONPROPERTIES, oPropertyBag2);
                oPropertyBag1.put(PropertyBagHelper.CONNINFO_CRQE_SERVERDESCRIPTION, dsn);
                oPropertyBag1.put("Database DLL", database_dll);
                oConnectionInfo.setAttributes(oPropertyBag1);
                oConnectionInfo.setUserName(userName);
                oConnectionInfo.setPassword(pwd);
                // The Kind of connectionInfos is CRQE (Crystal Reports Query Engine).
                oConnectionInfo.setKind(ConnectionInfoKind.CRQE);
    // Add a Database table
              String tableName = "Building";
                Table oTable = new Table();
                oTable.setName(tableName);
                oTable.setConnectionInfo(oConnectionInfo);
                rcd.getDatabaseController().addTable(oTable, null);
        catch(ReportSDKException RsdkEx) {
                out.println(RsdkEx);  
        catch (Exception ex) {
              out.println(ex);  
    %>
    Throws the exception
    com.crystaldecisions.sdk.occa.report.lib.ReportSDKException: java.lang.NullPointerException---- Error code:-2147467259 Error code name:failed
    There was other sample code on SDN which suggested the following - adding the table after calling table.setDataFields() as in:
              String tableName = "Building";
                String fieldname = "Building_Name";
                Table oTable = new Table();
                oTable.setName(tableName);
                oTable.setAlias(tableName);
                oTable.setQualifiedName(tableName);
                oTable.setDescription(tableName) ;
                Fields fields = new Fields();
                DBField field = new DBField();
                field.setDescription(fieldname);
                field.setHeadingText(fieldname);
                field.setName(fieldname);
                field.setType(FieldValueType.stringField);
                field.setLength(40);
                fields.add(field);
                oTable.setDataFields(fields);
                oTable.setConnectionInfo(oConnectionInfo);
                rcd.getDatabaseController().addTable(oTable, null);
    This code succeeds, but it is not clear how to add that database field to a section.  If I attempt to call the following:
    FieldObject oFieldObject = new FieldObject();
                oFieldObject.setDataSourceName(field.getFormulaForm());
                oFieldObject.setFieldValueType(field.getType());
                // Now add it to the section
                oFieldObject.setLeft(3120);
                oFieldObject.setTop(120);
                oFieldObject.setWidth(1911);
                oFieldObject.setHeight(226);
                rcd.getReportDefController().getReportObjectController().add(oFieldObject, rcd.getReportDefController().getReportDefinition().getDetailArea().getSections().getSection(0), -1);
    Then I get an error (which is not unexpected)
    com.crystaldecisions.sdk.occa.report.lib.ReportDefControllerException: The field was not found.---- Error code:-2147213283 Error code name:invalidFieldObject
    How do I add one of the table.SetDataFields()  to my report to be displayed?
    Are there any other pointers or suggestions you may have?
    Thank you

  • When I try to open a Pages document from iCloud, created on my iPad, I get message stating I need a newer version of Pages.  When I go to app store all I get is "installed" when looking at pages app. my Macbook pro is up to date with all updates.

    When I try to open a Pages document from iCloud, created on my iPad, I get message stating I need a newer version of Pages.  When I go to app store all I get is "installed" when looking at pages app. my Macbook pro is up to date with all updates. Any ideas?

    You have 2 versions of Pages on your Mac.
    Pages 5 is in your Applications folder.
    Pages '09/'08 is in your Applications/iWork folder.
    You are alternately opening the wrong versions.
    Pages '09/'08 can not open Pages 5 files and you will get the warning that you need a newer version.
    Pages 5/5.01 can not open Pages 5.1 files and you will get the warning that you need a newer version.
    Pages 5.1 sometimes can not open its own files and you will get the warning that you need a newer version.
    Pages 5 can open Pages '09 files but may damage/alter them. It can not open Pages '08 files at all.
    Once opened and saved in Pages 5 the Pages '09 files can not be opened in Pages '09.
    Anything that is saved to iCloud is also converted to Pages 5 files.
    All Pages files no matter what version and incompatibility have the same extension .pages.
    Pages 5 files are now only compatible with themselves on a very restricted set of hardware, software and Operating Systems and will not transfer correctly on any other server software than iCloud.
    Apple has not only managed to confuse all its users, but also itself.
    Note: Apple has removed over 100 features from Pages 5 and added many bugs:
    http://www.freeforum101.com/iworktipsntrick/viewforum.php?f=22&sid=3527487677f0c 6fa05b6297cd00f8eb9&mforum=iworktipsntrick
    Archive/trash Pages 5, after exporting all Pages 5 files to Pages '09 or Word .docx, and rate/review it in the App Store, then get back to work.
    Peter

  • Problem when creating a Report with a schduled date

    When I tried to create a report with a Schedule (any option except NOW) I get the error of "First Report Occur Date should be after or equal to Current Date" unless I use a date of 2012-10-01 or later in the First report occurs on field.  Today's date is 2012-08-23.
    Let me know if you can recreate this and if or when there will be a fix.

    Hi Tim,
    I'm glad to see you've been configuring your On100, but sad to see you've hit another snag. We are looking into this issue now. I'll get back to you with an update.
    Thanks,
    The OnPlus Team

  • How to create a chart with dates?

    I've created a table with projects I have to deliver and the date they were delivered. I would like to create a chart from this data - however I can't figure out how to use date in the chart.
    Ideally the chart would work with the date (lets say from jan 01 to april 5) on the x-axis and the project on the y-axis. And a line that goes from time A (which marks the initial part of the project) to the time B (which marks the delivery date) defined on the table.
    Is it possible?
    heres a pic of what i mean:
    /Users/judavies/Desktop/Screen shot 2011-01-14 at 11.36.12 AM.png
    Message was edited by: jujudavies

    Hi Jerry,
    I'm ALMOST there! If you could help me with one last thing it would be amazing. I've uploaded my number project and you can downloaded it on the link bellow, if you prefer.
    I managed to do the same idea chart as you have. However I would like to have two bars for every JOB (y-axis). On my table i've inputed for every job 4 values = START DATE that was scheduled / Duration period scheduled (this happens prior to the job itself // START DATE Delivered / Duration Period Delivered (this is the actual time the JOB took place). This way I can see at the end of a JOB if I worked during the period I planned.
    using your example on the chart above (your reply) Could Proposal have a bar 1.0 / 4.0 - and bellow this bar have another one (with different colours) that went from 2.0 / 5.0 - for example? - the first one representing the "scheduled dates"and the second one representing what actually happened.
    I managed to do the four bars but couldnt manage to have them bellow each other.
    Tks again for your help
    files.me.com/jujudavies/wgugl1.numbers.zip
    x'jul.

Maybe you are looking for