Fill a table with the results of the refresh groups

Hello world

I need a little help.

I'm working on an Oracle 10.2.0.4 on windows.

I have a table I created like this:
Table name: DIM_REPLICA

COD_SEZ VCHAR2 (2)
NOME_SEZ VCHAR2 (20)
FLAG TANK (1)
DATE OF D_REPLICA

This DB I have 210 discount groups running every night. I need fill this table with the results of the refresh groups.

So when the refresh for example called ROME group runs I need to write on the table the name ROME in the field "NOME_SEZ", a Y or N if the refresh Group has worked in the field of the INDICATOR and LAST_DATE refresh force ran into the field of the D_REPLICA. The COD_SEZ field is a code that I get other things. It is not necessary for the moment. I can add it myself on my own.

Can someone help me please?

I was looking on the tables SYS DBA_JOBS and DBA_REFRESH these data, but I don't know what to take and how to fill the table. Trigger? Procedure? Any help will be great!

Thank you all in advance!

This forum is for SQL * PLus, questions and your question is about general issues Oracle. You will get a better response by posting your question in another forum - probably the General database instance.

Please close this thread and start over in another forum.

Tags: Oracle

Similar Questions

  • Is it possible to fill a table with the result of the active query?

    I try to get the content of the cursor c in the ap variable and the code I use is as follows:

    BEGIN
    DECLARE
    TYPE cur_typ IS REF CURSOR;
    c cur_typ;
    query_str VARCHAR2 (1000);
    work VARCHAR2 (1000);
    AP varchar2 (30000);
    to the varchar2 (30000);
    query varchar2 (30000);
    BEGIN
    query_str: = ' select ent_cod, ent_nom from grh_funcionarios where rownum < 10';
    query: = 'CURSOR c IS' |' select ent_cod, ent_nom from grh_funcionarios where rownum < 10';
    IMMEDIATE EXECUTION of the query;

    C OPEN FOR query_str;
    for ap loop query_str
    LOOP
    Fetch c ap;
    EXIT WHEN c % NOTFOUND;
    DBMS_OUTPUT. Put_line(àles);
    END LOOP;
    C CLOSE;
    END;
    END;

    I'll show you a basic approach to the dynamic approach refcursor. But you have to do a lot of work in order to customize it to your needs.

    Here is a demonstration of basic->

    satyaki>
    satyaki>select * from v$version;
    
    BANNER
    ----------------------------------------------------------------
    Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Prod
    PL/SQL Release 10.2.0.3.0 - Production
    CORE    10.2.0.3.0      Production
    TNS for 32-bit Windows: Version 10.2.0.3.0 - Production
    NLSRTL Version 10.2.0.3.0 - Production
    
    Elapsed: 00:00:00.22
    satyaki>
    satyaki>
    satyaki>DECLARE
      2     str         VARCHAR2 (30000);
      3
      4     cursor c1
      5     is
      6       select column_name
      7       from all_tab_columns
      8       where table_name = upper('&tab_nm')
      9       and   column_name = 'ENAME';
     10
     11     r1 c1%rowtype;
     12  BEGIN
     13     str := ' declare '||
     14            '   TYPE cur_typ IS ref cursor; '||
     15            '   c           cur_typ; '||
     16            '   query_str   VARCHAR2 (1000); '||
     17            '   gen_rec '||upper('&tab_nam')||'%rowtype; '||
     18            ' begin '||
     19            '  query_str := '||chr(39)||'select * from emp where rownum < 10'||chr(39)||'; '||
     20            '  OPEN c FOR query_str; '||
     21            '  LOOP '||
     22            '    FETCH c INTO gen_rec; '||
     23            '     EXIT WHEN c%NOTFOUND; ';
     24            for r1 in c1
     25            loop
     26      str := str||'   DBMS_OUTPUT.put_line (gen_rec.'||r1.column_name||'); ';
     27            end loop;
     28      str := str||'  END LOOP; '||
     29            '  CLOSE c; '||
     30            ' end; ';
     31
     32     execute immediate(str);
     33     --dbms_output.put_line(str);
     34  END;
     35  /
    Enter value for tab_nm: emp
    old   8:      where table_name = upper('&tab_nm')
    new   8:      where table_name = upper('emp')
    Enter value for tab_nam: emp
    old  17:           '   gen_rec '||upper('&tab_nam')||'%rowtype; '||
    new  17:           '   gen_rec '||upper('emp')||'%rowtype; '||
    SATYAKI
    SOURAV
    WARD
    JONES
    MARTIN
    BLAKE
    CLARK
    SCOTT
    KING
    
    PL/SQL procedure successfully completed.
    
    Elapsed: 00:00:00.16
    

    Hope this will give you a basic idea.

    Kind regards.

    LOULOU.

  • LOV cascading if I don't have only one table with the customer name and the name of the product in the ADF.

    Hi Please help me how to use cascade, if I don't have only one table with the customer name and the name of the product in the ADF... I use Jdeveloper 11.1.

    For the client, I used customer VO with client list to fill but to populate the product that I use bind variable PrODUCT_NAME select distinct from TABLE where client_name =: bindCustomer

    so first of all, I need to set the variable of liaison on behalf of the selected customer.

    Can you please tell me how to set this variable binding in this case.

    After you set the LOV to your product attribute, correspondting VO in the LOV will appear under view accessors.

    Change the accessor of the view, you will see the variable binding. Set its value to the customer field of the parent object.

    Visit this link: https://www.youtube.com/watch?v=nXwL2_RP7AQ

    Kind regards

    Elias.

  • How the values to insert into the table with the command insertion

    Dear all
    can someone tell me how the values to insert into the table with the command insert, I want to say I always use command insert behind my forms on what shutter release button press the button of my save, but today I had a form of 6i, where controls (textbox, combo, etc.) are delineated with directly the table with I guess than the Properties Windows , I created 3 columns in tand 3 text on forms fields, now kindly tell me how to do this fields to fill and do not insert command, I mean directly defined with table column



    Please help me its urgent

    Hello

    If the block is based on your database table, just committed the shape, then changes will be applied to the database.

    François

  • How to compare the length of the data to a staging table with the definition of the base table

    Hello
    I have two tables: staging of the table and the base table.
    I get flatfiles data in the staging of the table, depending on the structure of the requirement of staging of the table and the base table (length of each column in the staging table is 25% more data dump without errors) are different for ex: If we have the city long varchar 40 column in table staging there 25 in the base table. Once data are discharged into the intermediate table that I want to compare the actual length of the data for each column in the staging table with the database table definition (data_length for each column of all_tab_columns) and if no column is different length that I need to update the corresponding line in the intermediate table which also has an indicator called err_length.

    so for that I use the cursor c1 is select length (a.id), length (b.SID) of staging_table;
    c2 (name varchar2) cursor is select data_length all_tab_columns where table_name = 'BASE_TABLE' and column_name = name;
    But we get atonce data in the first query while the second slider, I need to get for each column and then compare with the first?
    Can someone tell me how to get the desired results?

    Thank you
    Manoi.

    Hey, Marco.

    Of course, you can set src.err_length in the USING clause (where you can reference all_tab_columns) and use this value in the SET clause.
    It is:

    MERGE INTO  staging_table   dst
    USING  (
           WITH     got_lengths     AS
                     (
              SELECT  MAX (CASE WHEN column_name = 'ENAME' THEN data_length END)     AS ename_len
              ,     MAX (CASE WHEN column_name = 'JOB'   THEN data_length END)     AS job_len
              FROM     all_tab_columns
              WHERE     owner          = 'SCOTT'
              AND     table_name     = 'EMP'
              )
         SELECT     s.ename
         ,     s.job
         ,     CASE WHEN LENGTH (s.ename) > l.ename_len THEN 'ENAME ' END     ||
              CASE WHEN LENGTH (s.job)   > l.job_len   THEN 'JOB '   END     AS err_length
         FROM     staging_table     s
         JOIN     got_lengths     l     ON     LENGTH (s.ename)     > l.ename_len
                             OR     LENGTH (s.job)          > l.job_len
         )     src
    ON     (src.ename     = dst.ename)
    WHEN MATCHED THEN UPDATE
         SET     dst.err_length     = src.err_length
    ;
    

    As you can see, you have to hardcode the names of the columns common to several places. I swam () to simplify that, but I found an interesting (at least for me) alternative grouping function involving the STRAGG user_defined.
    As you can see, only the subquery USING is changed.

    MERGE INTO  staging_table   dst
    USING  (
           SELECT       s.ename
           ,       s.job
           ,       STRAGG (l.column_name)     AS err_length
           FROM       staging_table          s
           JOIN       all_tab_columns     l
          ON       l.data_length  < LENGTH ( CASE  l.column_name
                                              WHEN  'ENAME'
                                    THEN      ename
                                    WHEN  'JOB'
                                    THEN      job
                                       END
                               )
           WHERE     l.owner      = 'SCOTT'
           AND      l.table_name     = 'EMP'
           AND      l.data_type     = 'VARCHAR2'
           GROUP BY      s.ename
           ,           s.job
           )     src
    ON     (src.ename     = dst.ename)
    WHEN MATCHED THEN UPDATE
         SET     dst.err_length     = src.err_length
    ;
    

    Instead of the user-defined STRAGG (that you can copy from AskTom), you can also use the undocumented, or from Oracle 11.2, WM_CONCAT LISTAGG built-in function.

  • kindly tell how to use the unique value of a table with the index 0

    kindly tell how to use the unique value of a table with the index 0

    Hi
     
    Yep, use Index Array as Gerd says. Also, using the context help ( + h) and looking through the array palette will help you get an understanding of what each VI does.
     
    This is fundamental LabVIEW stuff, perhaps you'd be better spending some time going through the basics.
     
    -CC
  • How to export data to excel that has 2 tables with the same number of columns and the column names?

    Hi everyone, yet once landed upward with a problem.

    After trying many things to myself, finally decided to post here...

    I created a form in form builder 6i in which clicking on a button, the data gets exported to the excel sheet.

    It works very well with a single table. The problem now is that I cannot do the same with 2 tables.

    Because the tables have the same number of columns and the columns names.

    Here are the 2 tables with column names:

    Table-1 (MONTHLY_PART_1) Table-2 (MONTHLY_PART_2)
    SL_NOSL_NO
    MODELMODEL
    END_DATEEND_DATE
    U-1U-1
    U-2U-2
    U-4U-4
    ..................
    ..................
    U-20U-20
    U-25U-25

    Given that the tables have the same column names, I get the following error :

    402 error at line 103, column 4

    required aliases in the SELECT list of the slider to avoid duplicate column names.

    So how to export data to excel that has 2 tables with the same number of columns and the column names?

    Should I paste the code? Should I publish this query in 'SQL and PL/SQL ' Forum?

    Help me with this please.

    Thank you.

    Wait a second... is this a kind of House of partitioning? Shouldn't it is a union of two tables instead a join?

    see you soon

  • update to column values (false) in a copy of the same table with the correct values

    Database is 10gr 2 - had a situation last night where someone changed inadvertently values of column on a couple of hundred thousand records with an incorrect value first thing in the morning and never let me know later in the day. My undo retention was not large enough to create a copy of the table as it was 7 hours comes back with a "insert in table_2 select * from table_1 to timestamp...» "query, so I restored the backup previous nights to another machine and it picked up at 07:00 (just before the hour, he made the change), created a dblink since the production database and created a copy of the table of the restored database.

    My first thought was to simply update the table of production with the correct values of the correct copy, using something like this:


    Update mnt.workorders
    Set approvalstat = (select b.approvalstat
    mnt.workorders a, mnt.workorders_copy b
    where a.workordersoi = b.workordersoi)
    where exists (select *)
    mnt.workorders a, mnt.workorders_copy b
    where a.workordersoi = b.workordersoi)

    It wasn't the exact syntax, but you get the idea, I wanted to put the incorrect values in x columns in the tables of production with the correct values of the copy of the table of the restored backup. Anyway, it was (or seem to) works, but I look at the process through OEM it was estimated 100 + hours with full table scans, so I killed him. I found myself just inserting (copy) the lines added to the production since the table copy by doing a select statement of the production table where < col_with_datestamp > is > = 07:00, truncate the table of production, then re insert the rows from now to correct the copy.

    Do a post-mortem today, I replay the scenario on the copy that I restored, trying to figure out a cleaner, a quicker way to do it, if the need arise again. I went and randomly changed some values in a column number (called "comappstat") in a copy of the table of production, and then thought that I would try the following resets the values of the correct table:

    Update (select a.comappstat, b.comappstat
    mnt.workorders a, mnt.workorders_copy b
    where a.workordersoi = b.workordersoi - this is a PK column
    and a.comappstat! = b.comappstat)
    Set b.comappstat = a.comappstat

    Although I thought that the syntax is correct, I get an "ORA-00904: 'A'. '. ' COMAPPSTAT': invalid identifier ' to run this, I was trying to guess where the syntax was wrong here, then thought that perhaps having the subquery returns a single line would be cleaner and faster anyway, so I gave up on that and instead tried this:

    Update mnt.workorders_copy
    Set comappstat = (select distinct)
    a.comappstat
    mnt.workorders a, mnt.workorders_copy b
    where a.workordersoi = b.workordersoi
    and a.comappstat! = b.comappstat)
    where a.comappstat! = b.comappstat
    and a.workordersoi = b.workordersoi

    The subquery executed on its own returns a single value 9, which is the correct value of the column in the table of the prod, and I want to replace the incorrect a '12' (I've updated the copy to change the value of the column comappstat to 12 everywhere where it was 9) However when I run the query again I get this error :

    ERROR on line 8:
    ORA-00904: "B". "" WORKORDERSOI ": invalid identifier

    First of all, I don't see why the update statement does not work (it's probably obvious, but I'm not)

    Secondly, it is the best approach for updating a column (or columns) that are incorrect, with the columns in the same table which are correct, or is there a better way?

    I would sooner update the table rather than delete or truncate then re insert, as it was a trigger for insert/update I had to disable it on the notice re and truncate the table unusable a demand so I was re insert.

    Thank you

    Hello

    First of all, after post 79, you need to know how to format your code.

    Your last request reads as follows:

    UPDATE
      mnt.workorders_copy
    SET
      comappstat =
      (
        SELECT DISTINCT
          a.comappstat
        FROM
          mnt.workorders a
        , mnt.workorders_copy b
        WHERE
          a.workordersoi    = b.workordersoi
          AND a.comappstat != b.comappstat
      )
    WHERE
      a.comappstat      != b.comappstat
      AND a.workordersoi = b.workordersoi
    

    This will not work for several reasons:
    The sub query allows you to define a and b and outside the breakets you can't refer to a or b.
    There is no link between the mnt.workorders_copy and the the update and the request of void.

    If you do this you should have something like this:

    UPDATE
      mnt.workorders     A      -- THIS IS THE TABLE YOU WANT TO UPDATE
    SET
      A.comappstat =
      (
        SELECT
          B.comappstat
        FROM
          mnt.workorders_copy B   -- THIS IS THE TABLE WITH THE CORRECT (OLD) VALUES
        WHERE
          a.workordersoi    = b.workordersoi      -- THIS MUST BE THE KEY
          AND a.comappstat != b.comappstat
      )
    WHERE
      EXISTS
      (
        SELECT
          B.comappstat
        FROM
          mnt.workorders_copy B
        WHERE
          a.workordersoi    = b.workordersoi      -- THIS MUST BE THE KEY
          AND a.comappstat != b.comappstat
      )
    

    Speed is not so good that you run the query to sub for each row in mnt.workorders
    Note it is condition in where. You need other wise, you will update the unchanged to null values.

    I wouold do it like this:

    UPDATE
      (
        SELECT
          A.workordersoi
          ,A.comappstat
          ,B.comappstat           comappstat_OLD
    
        FROM
          mnt.workorders        A      -- THIS IS THE TABLE YOU WANT TO UPDATE
          ,mnt.workorders_copy  B      -- THIS IS THE TABLE WITH THE CORRECT (OLD) VALUES
    
        WHERE
          a.workordersoi    = b.workordersoi      -- THIS MUST BE THE KEY
          AND a.comappstat != b.comappstat
      ) C
    
    SET
      C.comappstat = comappstat_OLD
    ;
    

    This way you can test the subquery first and know exectly what will be updated.
    This was not a sub query that is executed for each line preformance should be better.

    Kind regards

    Peter

  • Drop a large number of tables with the same prefix

    Hello

    can you help me to make a script to move all the tables with the same prefix = TEST_LINK_?

    Thank you very much.
    Crystal

    Hi crystal,

    Here's something to start. It does not all FK constraints on those tables and assumes that the executor is the owner.

    declare
      pstmt  constant varchar2(255) := 'drop table :t purge';
      vstmt varchar2(255);
    begin
    for rec in (select table_name
                  from user_tables
                 where table_name like 'TEST_LINK\_%' escape '\')
       loop
          vstmt := replace(pstmt, ':t', rec.table_name);
          dbms_output.put_line(vstmt || ';');
    --      execute immediate vstmt;
       end loop;
    end;
    /
    

    Concerning
    Peter

  • How to create the table with the rows and columns using the layout?

    One of my friends advised me to put my site on the mode of provision as it is better than the standard as he said
    but I couldnot make an ordinary table with the rows and columns in mode available th
    y at - there someone who can tell me how to?
    Thank you very much

    Wednesday, April 18, 2007 21:01:38 + 0000 (UTC), "Mr.Ghost".
    wrote:

    > A friend of mine advised me to put my whole site on the mode of disposal as its
    > better than standard, as he says

    Your friend won't. Don't listen to him any more. Mode of disposal creates
    very fragile and rigid code pauses at the first opportunity.

    Gary

  • It is possible to have two tables with the same name in Oracle!

    Oracle Version: 10 gr 2

    MS Access 2007, I had to use the 'Export' by which I copy a table (and its data) to an Oracle schema via an ODBC connection. Later, I realized that, during the copy of tables with a mix of lower and upper case names, the table does not copied (exported). But MS Access will give you the message that table obtained export successfully.

    MS-Access mess around Oracle data dictionary.

    When you issue
    SQL>select * from tab;
    
    TNAME                          TABTYPE  CLUSTERID
    ------------------------------ ------- ----------
    AMStates                       TABLE
    Version                        TABLE
    You will see the names of the tables. But when you try to DESCRIBE or SELECT this table, you will
    SQL>desc Version
    ERROR:
    ORA-04043: object Version does not exist
    You can even create another table with the same name in the schema
    SQL>create table VERSION (X NUMBER);
    
    Table created.
    Why this is happening and how can I bring these items 'non-existent '?

    Hello

    Use

    SQL > desc 'Version '.

    Or

    SQL > select * from 'Version '.

    Or

    SQL > drop table 'Version '.

    To overcome the problems of mixed-case.

  • OWB, I need to update the target table with the same field for game/update

    OWb, I try to update the target table with the game and the update on the same ground is this possible. I'm a match merge error indicating that you cannot update and match on the same ground. But in SQl is my selection

    Update table
    define RFID = 0
    where RFID = 1
    and ID_processus = 'TEST '.

    Can HWO I do this in OWB.

    I have check but in the case later (last one) that he warns no error if you can go with it.
    and I tested it it works

    You can check the first case (from where we start) if it has been warned and then try to run.

  • CSS Display table with the bottom border only

    Hi all
    I'm very bad in CSS, I seriously need a style.

    I want the table with the bottom border only

    I tried like
    < table frame = "below" cellpadding = "2px" cellspacing = "0" style = "overflow: scroll;" empty-cells: show; border: 1px solid #285577; "width ="350px"> ';

    but frame = 'below' does not work with IE - 7

    Please could give me a solution.

    Thanks in advance
    Good bye
    Sonny_starck

    Sonny_starck,

    I don't know what kind of table you need exactly but

    < table style = "" border-bottom: 1px solid #285577; ">"

    should do the job.

    Denes Kubicek
    -------------------------------------------------------------------
    http://deneskubicek.blogspot.com/
    http://www.Opal-consulting.de/training
    http://Apex.Oracle.com/pls/OTN/f?p=31517:1
    -------------------------------------------------------------------

  • Fill a table with date values with a fixed increment

    Hello

    I want to fill a table with a date column with the increment of a fixed value date values. The start date is selectable, the increment is selectable and the number of records is adjustable as well.
    For example
    start date is 1905-Jan-02, 15:00 (DD-MON-YYYY, HH24:MI:SS)
    increment is 1 hour and 5 minutes
    None. records is 10
    then the dates in the table must be
    REC 1 1905 - Jan - 02, 15:00
    REC 2 1905 - Jan - 02, 16:05
    REC 3 1905 - Jan - 02, 17:10
    ....
    REC 9 1905 - Jan - 02, 23:40
    REC 10 1905 - Jan - 03, 00:45:00

    We are working on 11 GR 2, the number of records can be between a few hundred and a few million and they must be ordered with Crescent of time (maybe to have a whole id).
    Any ideas how to fill this table (simple and fast?) using sql / plsql are welcome.

    Thanks, Hannes

    Something along the lines of:

    SQL> alter session set nls_date_format = 'YYYY-Mon-DD HH24:MI:SS';
    
    Session altered.
    
    SQL> select trunc(sysdate,'HH')+((rownum-1)*(1/24)*(65/60)) as dt
      2  from dual connect by rownum <= 20;
    
    DT
    --------------------
    2010-Aug-26 16:00:00
    2010-Aug-26 17:05:00
    2010-Aug-26 18:10:00
    2010-Aug-26 19:15:00
    2010-Aug-26 20:20:00
    2010-Aug-26 21:25:00
    2010-Aug-26 22:30:00
    2010-Aug-26 23:35:00
    2010-Aug-27 00:40:00
    2010-Aug-27 01:45:00
    2010-Aug-27 02:50:00
    2010-Aug-27 03:55:00
    2010-Aug-27 05:00:00
    2010-Aug-27 06:05:00
    2010-Aug-27 07:10:00
    2010-Aug-27 08:15:00
    2010-Aug-27 09:20:00
    2010-Aug-27 10:25:00
    2010-Aug-27 11:30:00
    2010-Aug-27 12:35:00
    
    20 rows selected.
    
  • [ADF, JDev12.1.3] How to create a new record in a table filling one filed with the IP address of the client?

    Hallo,

    I create a stubborn workflow that begins with a create operation on the table where a new record should be added.

    The recording fields must be filled in by the user, but before committing, I have to fill a field of the reocord with the address IP of the PC of the user.

    Could you kindly advice me which are the possible recommended approaches to achieve this?

    Thank you

    Federico

    Hello

    See this post: Blog of Zeeshan Baig: how to get the IP address of the customer in ADF merge request

    You can use a createWithParams operation and to fill in this field.

    Reference: Andrejus Baranovskis Blog: CreateWithParams operation for Oracle ADF 11g BC

    Kind regards

    Ruben.

Maybe you are looking for

  • Outlook Express 6 - 0x800CCC0E Error Message When you try to send or receive mail

    Hello, can someone give me help with a problem I have with OE6.This problem happens only from Sunday 15, prior to that, everything worked fine. I get the following message about the ports 25 and 110 - no, error Socket Error: 10061 no 0x800CCC0E - OE

  • IncompEte scanning on Photosmart 5520

    When I scan a page of text inside a box, only the box and its contents are scanned, the rest of the page is blank. I use a MacBook Pro.

  • POUVEZ synchronization problems

    Hi all I'm working on a project to control an industrial player on CAN (CAN be opened to be precise).  I am trying to send and receive messages at regular intervals of 100 Hz.  To do this, I used at the same time while loops (after initialization of

  • Compac presario c501nr: C501NR ram

    I'll try to find 1 what type of ddr is - that is to say this use. DDR1 ddr2 or ddr3 2 what is the largest available RAM stick? all ideas Thanks for your time

  • Cannot access hidden admin account?

    I use windows vista on a dell latitude D410. recently, I created an admin account hidden via regedit and deleted the original account administrator privileges. now, when I try Ctrl + alt + del on the logon screen, it does nothing. When I try to make