Avoid trigger on all tables in schema

I need to set a CREATE TIME STAMP to the database server timestamp (not the session timestamp) in all tables in a schema for both create and update. Other than creating a trigger on all the tables in the schema is there a less tedious way to do that?
Similarly I need to to set columns such as CREATE_USER, LAST_UPDATE_USER.
Thanks in anticipation.

You can easily generate the DDL to add the new columns.
As far as populating the columns your choices are either use table befire insert and update triggers to populate the columns or have the application provide the necessary information.
The basic trigger logic would be pretty well the same for all the tables so writing a little SQL or PL/SQL to generate the trigger code should be pretty straight forward.
Depending on your application, such as web based with only one Oracle user, you may need to obtain the real user via dbms_application_info set by the application server based logic.
HTH -- Mark D Powell --
Edited by: Mark D Powell on May 5, 2010 7:48 AM

Similar Messages

  • Analyzing all tables in schema

    Hello everyone,
    I am used below command to analyze all tables in schema
    EXEC DBMS_STATS.gather_schema_stats (ownname => 'CONTRACT', cascade =>true,estimate_percent => dbms_stats.auto_sample_size);when look at tables in dba_tables, for none of the tables LAST_ANALYZED date is changed to today. But when I did below
    EXECUTE DBMS_STATS.GATHER_TABLE_STATS(ownname => 'CONTRACT', tabname => 'CONT_NAME', method_opt => 'FOR ALL COLUMNS', granularity => 'ALL', cascade => TRUE, degree => DBMS_STATS.DEFAULT_DEGREE);I am see LAST_ANALYZED changed to today in dba_tables.
    If I need to change LAST_ANALYZED to all tables do I need to produce the above command for all tables? There are more then 700 tables for this application.
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
    PL/SQL Release 11.2.0.2.0 - Production
    CORE    11.2.0.2.0      Production
    TNS for IBM/AIX RISC System/6000: Version 11.2.0.2.0 - Production
    NLSRTL Version 11.2.0.2.0 - Production

    user3636719 wrote:
    EXEC DBMS_STATS.gather_schema_stats (ownname => 'CONTRACT', cascade =>true,estimate_percent => dbms_stats.auto_sample_size);
    and
    EXECUTE DBMS_STATS.GATHER_TABLE_STATS(ownname => 'CONTRACT', tabname => 'CONT_NAME', method_opt => 'FOR ALL COLUMNS', granularity => 'ALL', cascade => TRUE, degree => DBMS_STATS.DEFAULT_DEGREE);are fundamentally different, you cannot compare them. In gather_schema_stats, oracle used most defaults, decided none needed new stats collected, so it didn't do anything. In the second, you changed method_opt, granularity and degree etc from default values (as set in your db perhaps), so db went ahead and collected stats.
    You need to look up manual and try to understand the default and non-default behavior for parameters and then make an educated decision. Changing stats randomly is not generally a great idea.

  • How to delete all TABLEs in Schema SYS which are created since 09:15?

    Unfortunately a script created lots of tables in the wrong Tablespace (=SYSTEM) and Schema (=SYS).
    How can I delete (in one DDL command) all TABLES which are created inTablespace=SYSTEM and SCHEMA=SYS
    during the last 3 hours resp. since 09:15 of 25th Sep 2011 ?
    Alternatively: How can I move these TABLEs to another Schema (e.g. ATEST) and Tablespace (USERS)?
    Is this possible with Oracle XE or only with Oracle Enterprise?
    Peter

    user559463 wrote:
    Unfortunately a script created lots of tables in the wrong Tablespace (=SYSTEM) and Schema (=SYS).
    How can I delete (in one DDL command) all TABLES which are created inTablespace=SYSTEM and SCHEMA=SYS
    during the last 3 hours resp. since 09:15 of 25th Sep 2011 ?
    Alternatively: How can I move these TABLEs to another Schema (e.g. ATEST) and Tablespace (USERS)?
    Is this possible with Oracle XE or only with Oracle Enterprise?
    PeterYou can query dba_objects and join it with dba_tables where tablespace_name='SYSTEM' , then drop the tables result of the query; the idea is to use the following query;
    SQL> select OWNER, OBJECT_NAME from dba_objects where OBJECT_TYPE='TABLE' and OWNER = 'SYS' and CREATED >= sysdate - 3 / 24;Please consider marking your questions as answered, when it is the case;
    Handle:      user559463 
    Status Level:      Newbie
    Registered:      Feb 18, 2007
    Total Posts:      583
    Total Questions:      266 (186 unresolved)Edited by: orawiss on Sep 26, 2011 4:03 PM

  • Fastest way to update column in all tables of schema

    In our schema we have two columns ColA and ColB common in all tables in our schema.
    Suppose these columns have values as below in all tables
    ColA     ColB     
    A1     B11     
    A12     B22     
    ABC     DEF     
    Now we have to update ColA and ColB where we have alphanumeric values in all tables, some tables have few hundred records and some tables have millions of records.
    Could you gurus suggest me with a fastest way to acheive this.
    What we are thinking is to write a procedure where we can input multiple tables which could be updated simultaneously and make a collection within procedure with following values
    ColA     ColA_R     ColB     ColB_R     
    A1     aa     B11     bb     
    A12     aaa     B22     bbb     
    ABC     No Update DEF     No Update     
    So whenever we have value matching A1 update it with value aa if we have value matching B11 update it with value bb and so on.
    Your inputs are welcome so that to acheive this in fastest manner.
    Thanks,
    Tony
    Edited by: tony29743 on Nov 9, 2010 9:15 AM

    I would be tempted to do it something like this:
    Create an index organized table for the cola updates (old_val, new_val) with a PK on old_val and another one for the colb Values. This could possibliy be a single table, depending on how many distinct values there were for cola and colb and if you are sure that "But if colA and colB have value A1 then it will be updated with aa".
    Then do the updates as an updateable join view something like:
    UPDATE (SELECT t1.cola, iot.new_val
            from tab1 t1, new_values_iot iot
            where t1.cola = iot.old_val)
    SET cola = new_valThis would require two rounds of updates, one for cola and one for colb, but they could be parallelized somewhat by distributing the tables to be updated through several pl/sql blocks each updating a different set of tables.
    You may be able to do it in a single query like:
    UPDATE (SELECT t1.cola, t1.colb, iota.new_val new_vala, iotb.new_val new_valb
            from tab1 t1, new_values_iot iota, new_values_iot iotb,
            where t1.cola = iota.old_val and
                  t1.cola = iotb.old_val)
    SET cola = new_vala,
        colb = new_valbHowever, given that you said there were some values in both cola and colb that did not require updating, that may not work since the join will fail on one of cola or colb if that value is not in the IOT, so you will not get all of the rows updated. If, and it is a big if, either both of cola and colb or neither of cola annd colb need to be updated in a single row, it might work. So, looking at your original examples (ABC and DEF do not require updates but A1 does), if there could be as case where cola = 'A1' and colb = 'DEF' then you will have to do it in two updates per table.
    John

  • Datapump API: Import all tables in schema

    Hi,
    how can I import all tables using a wildcard in the datapump-api?
    Thanks in advance,
    tensai

    _tensai_ wrote:
    Thanks for the links, but I already know them...
    My problem is that I couldn't find an example which shows how to perform an import via the API which imports all tables, but nothing else.
    Can someone please help me with a code-example?I'm not sure what you mean by "imports all tables, but nothing else". It could mean that you only want to import the tables, but not the data, and/or not the statistics etc.
    Using the samples provided in the manuals:
    DECLARE
      ind NUMBER;              -- Loop index
      h1 NUMBER;               -- Data Pump job handle
      percent_done NUMBER;     -- Percentage of job complete
      job_state VARCHAR2(30);  -- To keep track of job state
      le ku$_LogEntry;         -- For WIP and error messages
      js ku$_JobStatus;        -- The job status from get_status
      jd ku$_JobDesc;          -- The job description from get_status
      sts ku$_Status;          -- The status object returned by get_status
      spos NUMBER;             -- String starting position
      slen NUMBER;             -- String length for output
    BEGIN
    -- Create a (user-named) Data Pump job to do a "schema" import
      h1 := DBMS_DATAPUMP.OPEN('IMPORT','SCHEMA',NULL,'EXAMPLE8');
    -- Specify the single dump file for the job (using the handle just returned)
    -- and directory object, which must already be defined and accessible
    -- to the user running this procedure. This is the dump file created by
    -- the export operation in the first example.
      DBMS_DATAPUMP.ADD_FILE(h1,'example1.dmp','DATA_PUMP_DIR');
    -- A metadata remap will map all schema objects from one schema to another.
      DBMS_DATAPUMP.METADATA_REMAP(h1,'REMAP_SCHEMA','RANDOLF','RANDOLF2');
    -- Include and exclude
      dbms_datapump.metadata_filter(h1,'INCLUDE_PATH_LIST','''TABLE''');
      dbms_datapump.metadata_filter(h1,'EXCLUDE_PATH_EXPR','LIKE ''TABLE/C%''');
      dbms_datapump.metadata_filter(h1,'EXCLUDE_PATH_EXPR','LIKE ''TABLE/F%''');
      dbms_datapump.metadata_filter(h1,'EXCLUDE_PATH_EXPR','LIKE ''TABLE/G%''');
      dbms_datapump.metadata_filter(h1,'EXCLUDE_PATH_EXPR','LIKE ''TABLE/I%''');
      dbms_datapump.metadata_filter(h1,'EXCLUDE_PATH_EXPR','LIKE ''TABLE/M%''');
      dbms_datapump.metadata_filter(h1,'EXCLUDE_PATH_EXPR','LIKE ''TABLE/P%''');
      dbms_datapump.metadata_filter(h1,'EXCLUDE_PATH_EXPR','LIKE ''TABLE/R%''');
      dbms_datapump.metadata_filter(h1,'EXCLUDE_PATH_EXPR','LIKE ''TABLE/TR%''');
      dbms_datapump.metadata_filter(h1,'EXCLUDE_PATH_EXPR','LIKE ''TABLE/STAT%''');
    -- no data please
      DBMS_DATAPUMP.DATA_FILTER(h1, 'INCLUDE_ROWS', 0);
    -- If a table already exists in the destination schema, skip it (leave
    -- the preexisting table alone). This is the default, but it does not hurt
    -- to specify it explicitly.
      DBMS_DATAPUMP.SET_PARAMETER(h1,'TABLE_EXISTS_ACTION','SKIP');
    -- Start the job. An exception is returned if something is not set up properly.
      DBMS_DATAPUMP.START_JOB(h1);
    -- The import job should now be running. In the following loop, the job is
    -- monitored until it completes. In the meantime, progress information is
    -- displayed. Note: this is identical to the export example.
    percent_done := 0;
      job_state := 'UNDEFINED';
      while (job_state != 'COMPLETED') and (job_state != 'STOPPED') loop
        dbms_datapump.get_status(h1,
               dbms_datapump.ku$_status_job_error +
               dbms_datapump.ku$_status_job_status +
               dbms_datapump.ku$_status_wip,-1,job_state,sts);
        js := sts.job_status;
    -- If the percentage done changed, display the new value.
         if js.percent_done != percent_done
        then
          dbms_output.put_line('*** Job percent done = ' ||
                               to_char(js.percent_done));
          percent_done := js.percent_done;
        end if;
    -- If any work-in-progress (WIP) or Error messages were received for the job,
    -- display them.
           if (bitand(sts.mask,dbms_datapump.ku$_status_wip) != 0)
        then
          le := sts.wip;
        else
          if (bitand(sts.mask,dbms_datapump.ku$_status_job_error) != 0)
          then
            le := sts.error;
          else
            le := null;
          end if;
        end if;
        if le is not null
        then
          ind := le.FIRST;
          while ind is not null loop
            dbms_output.put_line(le(ind).LogText);
            ind := le.NEXT(ind);
          end loop;
        end if;
      end loop;
    -- Indicate that the job finished and gracefully detach from it.
      dbms_output.put_line('Job has completed');
      dbms_output.put_line('Final job state = ' || job_state);
      dbms_datapump.detach(h1);
    exception
      when others then
        dbms_output.put_line('Exception in Data Pump job');
        dbms_datapump.get_status(h1,dbms_datapump.ku$_status_job_error,0,
                                  job_state,sts);
        if (bitand(sts.mask,dbms_datapump.ku$_status_job_error) != 0)
        then
          le := sts.error;
          if le is not null
          then
            ind := le.FIRST;
            while ind is not null loop
              spos := 1;
              slen := length(le(ind).LogText);
              if slen > 255
              then
                slen := 255;
              end if;
              while slen > 0 loop
                dbms_output.put_line(substr(le(ind).LogText,spos,slen));
                spos := spos + 255;
                slen := length(le(ind).LogText) + 1 - spos;
              end loop;
              ind := le.NEXT(ind);
            end loop;
          end if;
        end if;
        -- dbms_datapump.stop_job(h1);
        dbms_datapump.detach(h1);
    END;
    /This should import nothing but the tables (excluding the data and the table statistics) from an schema export (including a remapping shown here), you can play around with the EXCLUDE_PATH_EXPR expressions. Check the serveroutput generated for possible values used in EXCLUDE_PATH_EXPR.
    Use the DBMS_DATAPUMP.DATA_FILTER procedure if you want to exclude the data.
    For more samples, refer to the documentation:
    http://download.oracle.com/docs/cd/B28359_01/server.111/b28319/dp_api.htm#i1006925
    Regards,
    Randolf
    Oracle related stuff blog:
    http://oracle-randolf.blogspot.com/
    SQLTools++ for Oracle (Open source Oracle GUI for Windows):
    http://www.sqltools-plusplus.org:7676/
    http://sourceforge.net/projects/sqlt-pp/

  • Truncate all tables in schema

    Hi,
    I want to truncate all tables (300 tables) in a schema. There are some enabled constraints in this schema. I want to keep all tables attached objects (like indexes, constraints, etc). I’d like to create a procedure to do this job. What's the safe and right way for this?
    I am thinking as follows:
    1- Retrieve all user constraints name using user_constrants view and then disable them.
    2- Retrieve all user tables name using user_tables view and then Truncate them.
    3- Enable all constraints that were disabled in step 1.
    Is this a safe and right way?
    Let me know your thought please. Thanks.

    The table was probably created using double qoutes.
    declare
    v_new_tab_name varchar2(35);
    for c1 in (select table_name from user_tables) loop
       begin
           execute immediate ( 'truncate table '||C1.Table_Name );
       exception
          when others then
              v_new_tab_name := '"' || C1.Table_Name|| '"' ;
              execute immediate (' truncate table '||v_new_tab_name) ;
       end ;
    end loop;
    end;

  • Trigger for logging changes(DML changes) for All tables in Schema

    Hi ,
    Is there a way to create a schema level trigger to audit the DML changes that affect all the tables.I need the output in my log table as
    1) the table name on which the DML occurred
    2) type of DML
    3) column names affected.
    I know this can be achieved through enabling AUDIT or by creating dynamically, triggers for each tables...
    Is there a way to create a single trigger to achieve this??

    It's not possible to create DML trigger on schema level
    I think the only way is to create the triggers dynamically for each table..
    Re: Schema level Database triggers by Kamran Agayev
    Edited by: jeneesh on Oct 12, 2012 6:39 PM

  • Export all tables in schema using exp utility

    I need to export all the tables in a schema based on a where clause, how can I do this without having to identify all the tables in the tables= parameter?

    You can get all the tables by doing a user-level export, i.e.
    exp scott/tiger@TNS_name owner=scottwill export all Scott's tables. If you need to export only some of the tables owned by a particular user, you're stuck giving an explicit list until 10g.
    Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • Select from all tables in schema

    hi, i am trying to x,y from tables in a schema, getting "missing expression" error, working with oracle 11g.
    declare
    v_sql varchar2(4000);
    v_x number;
    v_y number;
    v_n number;
    begin
    for rec in (select table_name as table_name from all_tables where table_name like '%AM_%' ORDER BY 1) loop
    v_sql := 'select a.idnumber, t.x, t.y, table(sdo_util.getvertices(a.geometry)) t FROM '||rec.table_name ||' a';
    EXECUTE IMMEDIATE v_sql INTO v_n, v_x, v_y;
    dbms_output.put_line(v_n||v_x||v_y);
    end loop;
    end;

    hi two rows, with idnum and geometry columns...
    IDNUM
    GEOMETRY(SDO_GTYPE, SDO_SRID, SDO_POINT(X, Y, Z), SDO_ELEM_INFO, SDO_ORDINATES)
    GD8
    SDO_GEOMETRY(2003, 8307, NULL, SDO_ELEM_INFO_ARRAY(1, 1003, 1), SDO_ORDINATE_ARR
    AY(-.48230432, 51.4645609, -.47600566, 51.464582, -.47206108, 51.4645953, -.4654
    6537, 51.4646174, -.46423724, 51.4646216, -.45892656, 51.4646394, -.45671873, 51
    .4646468, -.45007509, 51.4646691, -.4487052, 51.4646737, -.44809122, 51.4646758,
    -.44748667, 51.4646778, -.44118568, 51.4646989, -.44038184, 51.4647016, -.43534
    624, 51.4647186, -.43415307, 51.4647226, -.43413338, 51.4647226, -.43410223, 51.
    4647227, -.43408667, 51.4647228, -.43408688, 51.4648537, -.43408691, 51.4648694,
    -.43408703, 51.4649432, -.43408705, 51.4649579, -.43408717, 51.4650319, -.4340872,
    51.4650481, -.43408741, 51.465177, -.4341061, 51.4651769, -.43413411, 51.465
    1768, -.43415863, 51.4651767, -.43493934, 51.4651741, -.43724392, 51.4651664, -.
    4381469, 51.4651633, -.43876878, 51.4651612, -.44038073, 51.4651558, -.4409811,
    51.4651538, -.44732658, 51.4651325, -.44759329, 51.4651316, -.44870078, 51.46512
    79, -.45213755, 51.4651164, -.45482423, 51.4651073, -.45795448, 51.4650968, -.46
    041684, 51.4650886, -.46194096, 51.4650834, -.46348669, 51.4650783, -.46492913,
    51.4650734, -.46744722, 51.465065, -.47410127, 51.4650426, -.47616935, 51.465035
    7, -.48152654, 51.4650177, -.48230505, 51.4650151, -.48235217, 51.4650149, -.482
    35215, 51.4650018, -.48235145, 51.4645722, -.48235143, 51.4645607, -.48230432, 51.4645609))
    IDNUM
    GEOMETRY(SDO_GTYPE, SDO_SRID, SDO_POINT(X, Y, Z), SDO_ELEM_INFO, SDO_ORDINATES)
    GD4
    SDO_GEOMETRY(2003, 8307, NULL, SDO_ELEM_INFO_ARRAY(1, 1003, 1), SDO_ORDINATE_ARR
    AY(-.48497261, 51.4772685, -.48209892, 51.4772786, -.48097228, 51.4772825, -.474
    22571, 51.477306, -.47275437, 51.4773112, -.46898013, 51.4773243, -.46659847, 51
    .4773326, -.46535204, 51.477337, -.4624971, 51.4773469, -.46135428, 51.4773509,
    -.45879869, 51.4773598, -.45693251, 51.4773663, -.45570651, 51.4773706, -.453196
    56, 51.4773794, -.45006644, 51.4773903, -.44747333, 51.4773993, -.44686181, 51.4774014, -.44408948,
    51.4774111, -.4389499, 51.477429, -.43830451, 51.4774313, -.
    4346623, 51.477444, -.43398218, 51.4774464, -.43331459, 51.4774487, -.43326608,
    51.4774489, -.43326612, 51.4775874, -.43326612, 51.4776043, -.43326616, 51.47774
    86, -.43326616, 51.4777641, -.43326619, 51.4779031, -.4333147, 51.4779029, -.472
    655, 51.4777657, -.47413516, 51.4777605, -.48497272, 51.4777227, -.48502579, 51.
    4777226, -.48502579, 51.4777106, -.48502568, 51.4772809, -.48502568, 51.4772684,
    -.48497261, 51.4772685))

  • List All Tables in Schema with LONG ?

    Is there a way to ID any Table in my Schema that has a LONG data type ?
    Looking for Query
    Thank you!

    or
    SELECT table_name,column_name FROM user_Tab_Columns WHERE data_type='LONG'or
    SELECT table_name,column_name FROM cols WHERE data_type='LONG'max

  • Adding One Line Code in all tables in Designer Trigger.

    I have 300+ tables in my Schema (All tables generated through Designer), I want to add one line of code in the begining of "Before Inset Row Trigger" of all tables, So what is the fastest way of doing that,
    Adding One Line Code in all tables in Designer Trigger.
    I don't want to go and modify each and every table

    You'll have to write a script that reads out the current contents of your triggers, add your line to this contents and dynamically "create or replace" the new trigger text.
    Beware, trigger_body column of user/all/dba_triggers is in a column with datatype LONG, so you'll have to use some sort of conversion.
    Good luck.
    regards,
    Rob.

  • Need to grant DML privileges to all tables in few schemas

    Hi,
    I need to grant DML privileges to all tables in few schemas to a role. How can I achieve that?
    I thought it's below syntax but it doesn't work. Please advice.
    grant ALL ON ALL TABLES IN SCHEMA <Schema_name>  TO <role_name>;Thanks,
    Gangadhar

    GR wrote:
    Hi,
    I need to grant DML privileges to all tables in few schemas to a role. How can I achieve that?
    I thought it's below syntax but it doesn't work. Please advice.
    grant ALL ON ALL TABLES IN SCHEMA <Schema_name>  TO <role_name>;
    There is no single command to grant privileges at that level. There are either ANY privileges or privileges on an object.
    You can write a bit of code to generate and execute what you want, but you would have to rerun it if any new tables were created.

  • Grant select only to all tables in certain schemas

    need to create an oracle database user with 'select only' right to all tables in schema OM + OE ( Order Management), Inventory(INV) and AR ( Account Receivables)

    apart from above suggestion dont forget to use to accomodate other schemas OM + OE ( Order Management), Inventory(INV) and AR ( Account Receivables);
    where a.owner in ('OM','OE','AR','INV');
    -- Raman.

  • Prevent user from deleting rows from all tables in his own schema

    Hi,
    How can I prevent user from deleting rows in all tables in his own schema.
    I want the user to not able to delete rows from any existing or new tables that might be added in the future.
    The user does not have the "DELETE ANY TABLE" system privilege.
    Please advise.
    Thanks.

    Nowadays, I'd also avoid triggers (if possible).
    Sometimes, when I daydream, I'm rewriting a few applications that I've contributed to as a newbie, and I'm very ashamed of it nowadays.
    From what I've experienced, in retrospective, the emphasis on teaching 'Oracle stuff' has been lying far too much on PL/SQL row-by-row oriented processing instead of letting Oracle 'crunch' sets at once.
    Most of my debugging hours ended up in discovering one or more database triggers 'doing stuff automagically'.
    Another nice blogpost: http://rwijk.blogspot.com/2007/09/database-triggers-are-evil.html
    Regarding OP's question:
    I would just rethink/reconsider this requirement completely.
    Correctly implementing privileges and roles seems the best way to go, yes.
    Triggers? Nah...
    pre-post-edit, noticed thread got updated just before posting
    Don't know what you mean with 'namedropping', but I think it's legitimate to point other readers to interesting Oracle related opinions/articles that do have a technical background and lots of interesting examples.
    post dreaded OTN outage edit (from here)
    Again: I would just rethink/reconsider this requirement completely.
    Both trigger/vpd are being used to hide a design flaw here.

  • Error while creating tables in schema since trigger already enabled

    Hi All,
    I am trying to insert newly created objects in userA,but am not able to insert "ora_dict_obj_type" type value in target table,
    Please see my error and script below:
    Error:
    Error report:
    SQL Error: ORA-00604: error occurred at recursive SQL level 1
    ORA-01858: a non-numeric character was found where a numeric was expected
    ORA-06512: at line 2
    00604. 00000 - "error occurred at recursive SQL level %s"
    *Cause:    An error occurred while processing a recursive SQL statement
    (a statement applying to internal dictionary tables).
    *Action:   If the situation described in the next error on the stack
    can be corrected, do so; otherwise contact Oracle Support.
    Script:I need to insert newly created objects into this table,here Object type is important because based object type i am going to create one more trigger to grant access automatically to other users using trigger.
    create table access_table
    (owner_name varchar2(30),
    object_name varchar2(30),
    object_type varchar2(30),
    created_time timestamp default current_timestamp);
    create or replace
    trigger access_trigger
    after create on schema
    begin
    insert into access_table values
    (ora_dict_obj_owner,
    ora_dict_obj_name,
    ora_dict_obj_type,
    current_timestamp);
    end access_trigger;
    Thanks
    Edited by: 983419 on Feb 9, 2013 7:20 AM

    insert into access_table values
    (ora_dict_obj_owner, --VARCHAR(30)
    ora_dict_obj_name, --VARCHAR(30)
    ora_dict_obj_type, --VARCHAR(20)
    current_timestamp --"TIMESTAMP WITH TIME ZONE"
    );The Oracle CURRENT_TIMESTAMP function will give you the current time with all details. It returns the current timestamp with time zone for the current session's time zone.
    --example
    SQL> select CURRENT_TIMESTAMP from dual;
    CURRENT_TIMESTAMP
    09-FEB-13 02.53.33.753000 PM 03:00You are inserting 'CURRENT_TIMESTAMP' ( TIMESTAMP WITH TIME ZONE datatype ) into the column with TIMESTAMP datatype.So what?? Can you please do some workout on what you said and post it here?
    Try this:
    create table access_table
    (owner_name varchar2(30),
    object_name varchar2(30),
    object_type varchar2(30),
    created_time TIMESTAMP WITH TIME ZONE default CURRENT_TIMESTAMP);
    NO NEED.
    Check this -
    ranit@XE11GR2>> create table access_table
      2  (owner_name varchar2(30),
      3  object_name varchar2(30),
      4  object_type varchar2(30),
      5  created_time timestamp default current_timestamp);
    Table created.
    Elapsed: 00:00:00.07
    ranit@XE11GR2>> insert into access_table(owner_name,object_name,object_type,created_time)
      2  values('rr','bb','xx',current_timestamp); -- "CURRENT_TIMESTAMP with TIME ZONE inserted"
    1 row created.
    Elapsed: 00:00:00.00
    ranit@XE11GR2>> insert into access_table(owner_name,object_name,object_type)
      2  values('rr2','bb2','xx2');
    1 row created.
    Elapsed: 00:00:00.01
    ranit@XE11GR2>> select *
      2  from access_table;
    OWNER_NAME                     OBJECT_NAME                    OBJECT_TYPE                    CREATED_TIME
    rr                             bb                             xx                             09-FEB-13 01.47.56.490000 PM
    rr2                            bb2                            xx2                            09-FEB-13 01.48.20.187000 PM
    Elapsed: 00:00:00.01Edited by: ranit B on Feb 10, 2013 3:20 AM
    -- code added

Maybe you are looking for