By comparing the number of different records of different tables of databases with Production DB

Hello

I updated 6 paintings of DEVEOPMENT and QA database production databases.

According to the request of the customer, I want to create a stored procedure to compare the number of tables with the number of Production DB records.

Could you please suggest me a better way to do this.

example: select count (*) in the emoployee@Devlopment_Database.  -I want to check with select count (*) from employee@Procuction_Database

Select count (*) in the emoployee@QA_Database.                 -I want to check with select count (*) from employee@Procuction_Database

Thank you

Vincent

If so, your question is asking how to create a database link?

CREATE THE DATABASE LINK

Tags: Database

Similar Questions

  • by comparing the number of records in the table child

    I have 3 tables below:

    Table 1 - Parent Table
    Table table2 child - who has the number of records for each record in Table1 (row_id in Table1 corresponds to par_row_id in Table2)
    Child table table 3 - has that number of records for each record in Table1 (row_id in Table1 corresponds to par_row_id in table 3)

    I would like to run an Oracle SQL query to identify all the separate row_id on Table1, for which the number of child records in Table2 does not match the number of child records in Table3

    I ask for help to identify the best way to identify these records in the parent table. If possible an example too, please.

    Thank you

    Published by: cseshan on February 3, 2013 01:35

    All by adding the simplest example (with the sample data that you were supposed to provide) below

    create table table1(row_id number primary key);
    
    create table table2(par_row_id number references table1);
    
    create table table3(par_row_id number references table1);
    
    insert into table1 values(1);
    insert into table2 values(1);
    insert into table3 values(1);
    
    insert into table1 values(2);
    insert into table2 values(2);
    insert into table2 values(2);
    
    insert into table1 values(3);
    insert into table3 values(3);
    insert into table3 values(3);
    
    insert into table1 values(4);
    insert into table2 values(4);
    insert into table2 values(4);
    insert into table2 values(4);
    insert into table3 values(4);
    insert into table3 values(4);
    
    commit;
    
    with child1_cnt as
    (
      select par_row_id,count(*) cnt
      from table2
      group by par_row_id
    ),
    child2_cnt as
    (
      select par_row_id,count(*) cnt
      from table3
      group by par_row_id
    ),
    all_counts as
    (
      select p.row_id,nvl(c1.cnt,0) c1_cnt,nvl(c2.cnt,0) c2_cnt
      from table1 p
       left outer join child1_cnt c1
         on ( p.row_id = c1.par_row_id )
       left outer join child2_cnt c2
         on ( p.row_id = c2.par_row_id )
    )
    select row_id,c1_cnt,c2_cnt
    from all_counts
    where c1_cnt != c2_cnt;
    
    ROW_ID C1_CNT C2_CNT
    ------ ------ ------
         2      2      0
         4      3      2
         3      0      2 
    
  • How to count the number of data records?

    Hey guys, how to count the number of records, I had on a data object variable?

    Im having a result of sql query in a variable like this:

    oDB.resolveNode("#command").query.select.value = "SELECT * FROM Customers WHERE CliNombre LIKE ' % ' + input1 +" %' ";

    oDB.open ();

    oDB.first ();

    So I need to count the number of records retrieved by this SQL query at the moment. Help please

    Then move the cursor back to the first record after you have your account.

    There is a keyword count in SQL that will allow you to get the account of your request. You can run that first - get your account, and then run the actual query to get the Recordset. This would require a separate data connection. Some examples of code.

    var xfa.event.newText = inName;
    If (inName == "") {}
    App.Alert ("you must enter a name--try again!")
    }
    var nIndex = 0;
    While (xfa.sourceSet.nodes.item (nIndex) .name! = "DataConnection2")
    {
    nIndex ++;
    }

    oDB = xfa.sourceSet.nodes.item (nIndex) .racing var (1); pertaining to the specified data connection node
    App.Alert (ODB.saveXML ("Pretty"));

    var nIndex = 0;
    While (xfa.sourceSet.nodes.item (nIndex) .name! = "DataConnection3")
    {
    nIndex ++;
    }
    var oDBCount = xfa.sourceSet.nodes.item (nIndex) .racing (1); pertaining to the specified data connection node
    Configure sql call DB to get the number of records that match the criteria

    oDBCount.nodes.item (1).query.setAttribute ("text", "commandType");
    oDBCount.nodes.item (1).query.select.nodes.item (0) .value = "Select count (*) from table1 where AcctNumber = '" + inName + "'";
    oDBCount.open)
    oDBCount.close)

    Configure sql call DB to get the specified employee number

    oDB.nodes.item (1).query.setAttribute ("text", "commandType");
    oDB.nodes.item (1).query.select.nodes.item (0) .value = "Select * from table1 where AcctNumber = '" + inName + "'";
    App.Alert (ODB. Nodes.Item (1) .saveXML ("Pretty"));

    now connect to the DB and get a recording
    oDB.open)
    oDB.close ();

    Note the SQL command use the keyword count (take a look at the oDBCount section). This will return a number of return to the cllaer. When I set up the data connection, a node count (*) that appeared there. I dragged to the form and it has created a field called count that the onus at this node. When the query is executed, the number of resulting records returns to this field. You can have hidden it so that your users can not see it and also to change the binding votes to zero, so it is not included in the data file that is submitted when the form is complete.

    Paul

  • Get the number of inserted records

    Hello

    I am moving from 6.1 to 8.0 and have found a query that runs in 6.1, but not in 8.0, and I wonder if there is a solution for this.

    What I do is to insert multiple records in a table and using @@rowcount to see the number of inserted records, this code has worked at 6.1 but the 'qry' variable is not defined in 8.0. Any help would be appreciated, thanks.

    You must use SET NOCOUNT to remove the number of records returned by the insert statement

    SET NOCOUNT ON
    INSERT INTO emp
    SELECT, l_name
    Candidates
    WHEN hiring = 1

    SELECT @@rowcount AS NumberOfRecords
    SET NOCOUNT OFF

  • Access to the number of property may not set through a reference with static type...

    Hi all!

    I encounter this problem today... Take a look at the code:

    import com.trick7.effects.TeraFire;

    for (var j: uint = 0; j < 10; j ++) {}

    var fire: TeraFire = new TeraFire();

    Fire.x = j * 40 + 20;

    Fire.y = 100;

    Fire.Number = j; This line is causeing the problem

    addChild (fire);

    fire.buttonMode = true;

    }

    Class TeraFire creates fire particles. Compiler error is:

    Scene 1, Layer 'layer 1', frame 1, line 7.1119: access of the number of property may not set through a reference with static type com.trick7.effects:TeraFire.

    Can someone help me find a solution to this problem.

    I can do this 'number' with a clip, but not in this case. What can I do?

    Sorry oops misspelling... I meant fire ['number'] = j;

    The class must also be dynamic for this work, i.e.:

    public dynamic class TeraFire extends MovieClip
    

    (a dynamic class extension is not the class dynamic sub...)

    --

    Kenneth Kawamoto

    http://www.materiaprima.co.UK/

  • How to count the number of columns in an oracle table using sql

    How to count the number of columns in an oracle table using sql

    You must put the name of the table in capital letters

    As

    SELECT COUNT(1)
      FROM user_tab_columns
    WHERE table_name = 'EMP';
    
    or
    
    SELECT COUNT(1)
      FROM user_tab_columns
    WHERE table_name = UPPER('Emp');
    

    Concerning
    Arun

  • Compare the number of predefined list

    I'm trying to get the phone number currently, and according to a predefined list, do some actions. To do this, I configured a custom PhoneListener and use the following code:

    //get the dialed number
    String phoneNumber = Phone.getActiveCall().getDisplayPhoneNumber();
    //get predefined number list, as Integers
    Vector numbers = Options.getContactNumbers();
    int dialedNumber = 0;
    
    //Convert the dialed number to int
    try{
        dialedNumber = Integer.parseInt(phoneNumber);
    }catch(Exception e){
        Dialog.alert("Disabled!");
        return false;
    }
    
    //loop the predefined number list
    for(int i=0;i
    

    The above code always shows people with disabilities! dialog box. I don't know why but it seems to throw an exception when parsing the string as an Int value. Phone.getActiveCall () .getDisplayPhoneNumber () retrieves the number dialled correctly, so I don't know why it fails during the analysis of this.

    Is there a better way to do what I'm doing?

    What have bb-ant-tools to do with System.out.println ()? They are simply tools of generation and are not running your code.

    You won't see any output to System.out. println() on a real device and on the Simulator, if you do not run it in the debugger.

    Then run your Simulator in debug mode and you'll see the output from System.out.println () and you will be able to see the values of the variables in your method and find out why the equals method fails.

    It is very easy to use and you should be able to spot the reason quite instantly.

  • Trying to count the number of different occurrences in a SQL statement.

    I am trying to achieve a sql statement, taking into account the number of occurrences of date for a person gives. ... Here's my query so far...

    ----------------------

    Select TO_DATE(SUBSTRC(trim(ppei.pei_information4),1,10),'RRRR/MM/DD') start_date, ppei.person_id,.
    case
    When ppei.person_id = 130385 then count(TO_DATE(SUBSTRC(trim(ppei.pei_information4),1,10),'RRRR/MM/DD'))
    END AS count_test
    of per_people_extra_info iepp
    where ppei.information_type = 'XXPER_CALL_IN_LOG. '
    and ppei.person_id = 130385
    Group of TO_DATE(SUBSTRC(trim(ppei.pei_information4),1,10),'RRRR/MM/DD'), ppei.person_id
    -----
    START_DATE PERSON_ID COUNT_TEST
    ------------------------- ---------------------- ----------------------
    MARCH 1, 11 130385 1
    MAY 20, 11 130385 1
    JUNE 12, 11 130385 1
    20 JUNE 11 130385 1
    18 AUGUST 11 130385 1

    5 selected lines

    That's what I want the data to look at...

    START_DATE PERSON_ID COUNT_TEST
    ------------------------- ---------------------- ----------------------
    MARCH 1, 11 130385 1
    MAY 20, 11 130385 2
    JUNE 12, 11 130385 3
    20 JUNE 11 130385 4
    18 AUGUST 11 130385 5


    Is it possible to do this?

    There is always a way ;-)
    And, if you'd be working with data easy, as I showed you, it would be easier for you and for the people in this forum.
    Select the field you need. Don't know what exactly you need to allow you to choose and to strengthen

    with test_data as
    (
    select to_date('01-MAR-11','DD-MON-RR') START_DATE, 130385 person_id, 'yes'  pei_information5 from dual union all
    select to_date('20-MAY-11','DD-MON-RR') START_DATE, 130385 person_id, 'yes'  pei_information5 from dual union all
    select to_date('12-JUN-11','DD-MON-RR') START_DATE, 130385  person_id, 'no'  pei_information5 from dual union all
    select to_date('20-JUN-11','DD-MON-RR') START_DATE, 130385  person_id, 'yes'  pei_information5 from dual union all
    select to_date('18-AUG-11','DD-MON-RR') START_DATE, 130385  person_id, 'yes'  pei_information5 from dual union all
    select to_date('01-MAR-11','DD-MON-RR') START_DATE, 111111 person_id, 'yes'  pei_information5 from dual union all
    select to_date('2-MAY-11','DD-MON-RR') START_DATE, 111111 person_id, 'no'  pei_information5 from dual union all
    select to_date('2-JUN-11','DD-MON-RR') START_DATE, 111111  person_id, 'no'  pei_information5 from dual union all
    select to_date('3-JUN-11','DD-MON-RR') START_DATE, 111111  person_id, 'no'  pei_information5 from dual union all
    select to_date('1-AUG-11','DD-MON-RR') START_DATE, 111111  person_id, 'yes'  pei_information5 from dual)
    ---
    select start_date,person_id,pei_information5,
      count(*) over (partition by person_id order by start_date) count_test,
      count(*) over (partition by person_id,pei_information5 order by start_date) count_test2,
      sum(case when pei_information5 ='yes' then 1 else 0 end) over (partition by person_id order by start_date) count_test3,
      sum(case when pei_information5 ='yes' then 1 else 0 end) over (partition by person_id,pei_information5 order by start_date) count_test4
      from test_data
      order by person_id,start_date;
    
    START_DATE                PERSON_ID              PEI_INFORMATION5 COUNT_TEST             COUNT_TEST2            COUNT_TEST3            COUNT_TEST4
    ------------------------- ---------------------- ---------------- ---------------------- ---------------------- ---------------------- ----------------------
    01.03.2011 00:00:00       111111                 yes              1                      1                      1                      1
    02.05.2011 00:00:00       111111                 no               2                      1                      1                      0
    02.06.2011 00:00:00       111111                 no               3                      2                      1                      0
    03.06.2011 00:00:00       111111                 no               4                      3                      1                      0
    01.08.2011 00:00:00       111111                 yes              5                      2                      2                      2
    01.03.2011 00:00:00       130385                 yes              1                      1                      1                      1
    20.05.2011 00:00:00       130385                 yes              2                      2                      2                      2
    12.06.2011 00:00:00       130385                 no               3                      1                      2                      0
    20.06.2011 00:00:00       130385                 yes              4                      3                      3                      3
    18.08.2011 00:00:00       130385                 yes              5                      4                      4                      4                      
    
  • Reduce the number of cells displayed by indicator table

    When I'm hacking through a few screws I inherited, I often create a table indicator to track data.  I have an oversized indicator, i.e. perhaps seven cells for what turns out to be a five-element array.

    I can easily increase the number of cells is displayed but seem not to be able to reduce their.

    Y at - it a trick I'm missing?

    When you first place a 1 d table control or an indicator, LabVIEW is unclear if you can stretch it horizontally or vertically.

    The RESIZE tool, that you get so something on the lower right.

    Once you have decided that you want to extend vertically, if you want to resize once again, the point of RESIZING is at the bottom of the Center.

    If you have it stretched horizontally and want to resize again, the point of RESIZING is the center of the right side.

    Is - this good user interface?   No, if you ask me.  But nobody asked me.  It's the way it is, however.

  • get the number of rows affected by their table top

    Hello, I need to count the number of rows updated in table form. In the process of ApplyMRU, I can use the string substitution #MRU_COUNT # to show the lines updated in a success message, but I need to get this value and store it on a table. Any help would be much appreciated. Thank you.

    oscarjavier99 wrote:

    Hello, I need to count the number of rows updated in table form. In the process of ApplyMRU, I can use the string substitution #MRU_COUNT # to show the lines updated in a success message, but I need to get this value and store it on a table. Any help would be much appreciated. Thank you.

    For that you would benefit from the APEX$ ROW_STATUS integrated substitution string.

    1. create a page element display only (in my case P15_UPDATED_ROWS) Save Session State set to Yes and the Type of Condition is set to never.

    2. Add a calculation after the shows with a Type of static assignment and calculation value 0 to reset the counter whenever the page is sent.

    3. Add an On submit - after calculations and Validations process of PL/SQL page linked to your tabular presentation with a Status of Type PL/SQL Expression and Expression 1 :apex$row_status = 'U' and the code of the following process :

    :p15_updated_rows := :p15_updated_rows + 1;
    

    If you don't actually means "day" in the strict sense, and then change the status of process to include possible APEX$ ROW_STATUS 'C', 'U', and "D" values as needed. If you want to count all created, updated and deleted lines, do not add the condition to the process, but make sure the extended run is set to createand changed lines.

  • How to get the number of lines of an af:table

    Hello

    I use JDeveloper 11.1.2.4.

    I have a table (t1) that is contained in a panelCollection. On the toolbar of this collection of Panel section, I placed an output text to display the number of rows in the table. I use below EL from there to achieve.

    < af:outputText value = "#{bindings." RtnVwOddShoesVO1Iterator.estimatedRowCount}"id ="ot11.

    partialTriggers = "t1" / >

    his shows the number of rows in the table when initially rendering. However, when none of the lines changes based on a condition, it is not be updated.

    Please can you advise if Miss me something?

    Thank you

    Bind the outputText property of bean of support, I say the pair of methods getOt11 () / setOt11 ().

    Then you can say:

    AdfFacesContext.getCurrentInstance () .addPartialTarget (getOt11 ());

    If it works, can you say thanks @Timo ;-)

  • How do I get the number of incorrect records when you use external tables

    Hi all, I have an external table DEPT,.

    DEPT. DAT

    20. ELECTRONICS

    10. SHOES

    30. CAMERA

    Select * from the Department; only 10 and 30 dept will be led as deptdescr for 20 that there are more than 10 in length so this record will go into the wrong file,

    y at - it count any query to display the folder or get any query to get the record to view the entries entries wrong file rather that will drop and see how much is rejected.

    Table:

    CREATE TABLE DEPT
    (
       DEPT        NUMBER,
       DEPTDESCR   VARCHAR2 (10 CHAR)
       )           ORGANIZATION EXTERNAL
      (  TYPE ORACLE_LOADER
         DEFAULT DIRECTORY BATCH_INBOX
         ACCESS PARAMETERS
           ( RECORDS DELIMITED  BY '\r\n'
                  BADFILE  BATCH_BAD:'UPS_DEPT_LOAD_%p.bad'
                  LOGFILE  BATCH_LOG:'UPS_DEPT_%p.log'
                  NODISCARDFILE
        FIELDS  TERMINATED BY '|'
        MISSING FIELD VALUES ARE NULL
    (
    DEPT,
    DEPTDESCR
    )
                                    )
         LOCATION (BATCH_INBOX:'DEPT.DAT')
      )
    REJECT LIMIT UNLIMITED
    NOPARALLEL
    NOMONITORING;
    

    You can use the wrong file as the data file for another external table, with the entire line in a single field.  Please see the demo below.

    Scott@orcl12c > CREATE or REPLACE DIRECTORY batch_inbox AS 'c:\my_oracle_files '.

    2.

    Created directory.

    Scott@orcl12c > CREATE or REPLACE DIRECTORY batch_bad AS 'c:\my_oracle_files '.

    2.

    Created directory.

    Scott@orcl12c > CREATE or REPLACE DIRECTORY batch_log AS 'c:\my_oracle_files '.

    2.

    Created directory.

    Scott@orcl12c > CREATE TABLE DEPT

    2       (

    NUMBER 3 DEPT,

    4 DEPTDESCR VARCHAR2 (10 CHAR)

    (5) ORGANIZATION EXTERNAL

    6 (TYPE ORACLE_LOADER

    7 DEFAULT DIRECTORY BATCH_INBOX

    8 ACCESS SETTINGS

    9 (RECORDS DELIMITED BY "\r\n"

    10 BADFILE BATCH_BAD: 'UPS_DEPT_LOAD.bad'

    11 BATCH_LOG:'UPS_DEPT_%p.log LOGFILE'

    12 NODISCARDFILE

    13 FIELDS TERMINATED BY ' |'

    14 MISSING FIELD VALUES ARE NULL

    15       (

    DEPT 16,

    17 DEPTDESCR

    18       )

    19                       )

    LOCATION 20 (BATCH_INBOX:'DEPT.) DAT')

    21         )

    RELEASE 22 UNLIMITED LIMIT

    23 NOPARALLEL

    24 NOMONITORING;

    Table created.

    Scott@orcl12c > SELECT * FROM dept

    2.

    DEPTDESCR DEPT

    ---------- ----------

    10 SHOES

    CAMERA 30

    2 selected lines.

    Scott@orcl12c > CREATE TABLE DEPT_bad

    2       (

    3 the_whole_row VARCHAR2 (4000)

    (4) ORGANIZATION EXTERNAL

    5 (TYPE ORACLE_LOADER

    6 DEFAULT DIRECTORY BATCH_INBOX

    7 ACCESS SETTINGS

    8 (RECORDS DELIMITED BY "\r\n"

    9 NOLOGFILE

    10 FIELDS TERMINATED BY '\r\n '.

    11. THE MISSING FIELD VALUES ARE NULL

    12       (

    13 the_whole_row CHAR (4000)

    14       )

    15                       )

    16 RENTAL (BATCH_BAD:'UPS_DEPT_LOAD.) THE BAD ")"

    17         )

    RELEASE 18 UNLIMITED LIMIT

    19 NOPARALLEL

    20 NOMONITORING

    21.

    Table created.

    Scott@orcl12c > SELECT * FROM dept_bad

    2.

    THE_WHOLE_ROW

    --------------------------------------------------------------------------------

    20. ELECTRONICS

    1 selected line.

  • How can I get the number of display automatically on a table line?

    I have an array of measures, and I would like the line number to display on each line. The challenge is that everytime I run the program, the total number of lines will be different, so I'd figures updated every time that I run the program based on the current number of lines.

    I've attached a picture to illustrate what I'm doing.

    Find the attached example (registered in the 2009 version), and you can extract what you need for your code!

  • How to integrate the structures of different tables in different databases?

    Hello

    I am new to oracle... well help me with the below question...

    I have the same set of attributes linked together (a, b, c and d) in two different databases A and B.

    The structure of the tables at the same time the database are different, but they carry the same attributes in the same relationship.

    I have to integrate these attributes to object unique db such as any update to the base tables updates my object. How can I do this and what object will be useful?


    Thank you

    Hi Arun,

    Then as you say they are of different databases, we can create a link between the databases and
    can create view based on the Tables.

    (i.e.) if the data in the base table changes the data in the view should also change in real time.

    Arun, of course, the view will also change in real time, because the view is nothing more than a virtual table.

    When you query on a view, he questioned the details of the * "Base Table" * only. If the data will be updated, i.e.
    existing in the Base Table.

    Thank you
    Shankar

  • Insert the record of one table to another with the help of the cursor

    Help, please!

    the tables are - 1. countries (country_id pk, country_name, region_id)
    2A (country_id, country_name, region_id)
    table data are
    1 to 1
    2 b 2
    3 C 3
    NULL d 4
    5 e 5
    6 f 6
    7 g 7
    -----------------------
    Insert the record in the table a country table with the help of the cursor, insert all the non-null records.
    This procedure does not correct result
    -----------------------

    create or replace
    Amit procedure as
    cursor c1 is select * from a;
    RW a % rowtype;
    Start
    Open c1;
    Fetch c1 into rw.
    While (C1% found)
    loop
    insert into countries values (rw.country_id, rw.country_name, rw.region_id);
    commit;
    Fetch c1 into rw.
    If rw.country_id is null then
    Fetch c1 into rw.
    end if;
    end loop;
    Close c1;
    exception
    while others then
    dbms_output.put_line ('exception = name ' |) RW.country_name);
    end;

    You don't need cursor at all;

    create or replace procedure amit as
    
    begin
      insert into countries (Country_ID, Country_Name, Region_ID)
      (select a.Country_ID
             ,a.Country_Name
             ,a.Region_ID
       from a
      );
    
      dbms_output.put_line('Rows inserted : ' || sql%rowcount);
    
      commit;
    
    end;
    /
    

Maybe you are looking for

  • photostream not sync properly on mac

    Here's the problem: photos recently taken does not sync on my mac, iPhoto or Photos. It started there, for no apparent reason about 2 months. Things were fine until here. Here are some details: OS = 10.11.5 iPhoto = 9.6.1 Pictures = 1.5 I don't use t

  • Satellite L650-14F - Windows 7 I need to install?

    Little help? If I install the 32-bit version of windows 7, all the RAM will be shown as windows xp 32-bit?

  • IMEI on the rear case have 1 number that does not correspond with the *.

    Hello I checked my Imei on 5 and I noticed that on the back casing has 1 digit does not match one that shows up on * #06 #. *#06#:  ************** case back: *. I check the imei number with: https://checkcoverage.apple.com/ , imei number on the * #06

  • HP Envy 5660: Win 10-5660 Envy - Scan of the computer is enabled no longer

    I understand that this has been reported several times by others.  No proposed solution does work for me.  Periodically, I get the error message "Scan of the computer is no longer enabled.»  The network connection to the printer has been lost.  This

  • Vista 32-bit resources

    I have a 32-bit system vista with 4 GB of ram and a 512MB Nvidia gcard, but I was told recently that windows allows 2 GB max to be used by the app?  I play Civ4 BtS + Mods and they need of more resources that the game seems to be crashing running out