Compare two pulse counts

Hello,
I'm trying to compare two simultaneous pulse counts using a cDAQ-9172 chassis, a 9401 card, and LabVIEW 8.2. What I want to do is set up a single output pulse that lasts for, say, 1000 incoming pulses on ctr0, and then use that single output pulse as a gate on ctr1 to count the input pulses that it sees during those 1000 pulses on ctr0. In other words, I want to synchronize the two counters, and as soon as ctr0 reaches 1000 pulses, they should both stop so I can compare the two counts. The issue is slightly complicated by the fact that both counter inputs are very noisy and require a pulse width filter in order to be read properly.
I more or less understand what needs to happen conceptually, but I'm at a loss for how to make it happen. A simple walkthrough would help enormously. Alternatively, if there's a better way to accomplish this, that would be helpful as well.
Thanks.

Thanks for the advice. I set up a program (attached) that tries to implement basically what you suggest, but there are still problems. The main issue is that it gives me an error -200141 message telling me to change the data transfer mechanism to DMA. When I set up a channel property node to do this, it tells me that DMA is not available.
The other concern I have involves the pulse width filter on the counter output task. The 1000 pulse signal is extremely noisy, and without any filtering, the noise will increase the frequency by a significant amount. I've set up the filters as you can see in the program, but I have no idea whether I've done this properly.
Any further help you could offer would be greatly appreciated.
Attachments:
even more gating.vi ‏39 KB

Similar Messages

  • Analogue Signal Pulse Count

    I am using CDAQ with a NI9229 4 Channel analgoue input card. 
    I have a sensor that outputs an analogue 5v square wave signal. The pulses are triggered from eithe a north or south pole of a magnet. I have  an aluminium wheel with 30 magnets, all magnets are in opposition to each other. when the wheel is rotated the output is a square wave.
    My magnet wheel is rotating at 182° per second. Over 360 degrees there is 30 magnets. Thus making the sensor switch 30 times.
    The time to revolve the wheel one revolution is 1.978 seconds.
    I have set up the NI9229 to the following
    - sampling rate is set to 25kS/s So to record the data for one revolution it works out as 49450 bits.
    - Have set the trigger levels for recording a hi or lo pulse to 2.7 and 0.7 volts.
    50000 samples would be two seconds worth of data which would be more than 360° of rotation of the magnet wheel.
    The problem I am having is that my pulse count changes between 30 and 31. But as I am only recording 1 revolution of data there is physically only 30 switches. Do you know why I am getting a change of 30 and 31.
    Attachments:
    pulse count 2.PNG ‏20 KB
    pulse count.PNG ‏19 KB
    front panel.PNG ‏83 KB

    I think I know what the problem is now but don’t know a way around it.
    I have attached two screen shots. One shows that the rising edges are counted as 15 and the falling as 16 the other shows both are 15. This is due to where it starts to take data I believe.
    For detecting the rising or falling edge I compare the data to 4.0 or 0.5v If its below 0.5 then sends a hi signal and counts 1, if its above 4.0 it sends a hi signal and counts1.
    But depending on when it starts taking data the signal is already a falling or rising edge. Comparing one bit of data on a rising  edge to see if its below 0.5 will send a hi as it hasn’t started to rise as shown in the first picture.
    Is there a better way to count pulses
    Attachments:
    1.PNG ‏61 KB
    2.PNG ‏64 KB

  • How do you cyclicly trigger data acquisition after n pulses counted

    Hello all, please forgive my ignorance because I am very new
    to lab view and data acquisition. I am working on a system which is going to
    scan an object and produce an image. The gimble that I am scanning the object
    with is an X-Y type of gimble with stepper motors on each axis. The stepper
    motor controller will output pulses real time to indicate the real time
    position of the gimble in each axis. What I need to be able to do is count
    pulses from the stepper motor controller and then output a trigger pulse to
    trigger the data acquisition in a buffered mode when N number of pulses have
    passed and then generate another pulse to stop the acquisition after another N
    number of pulses have passed. The controller puts out 10,000 pulses per degree
    of travel. The velocity that I am traveling at is 20 degrees per second, so
    timing here is really important. I need to be able to utilize the speed of the
    daq card and not so much the speed of the computer to iterate through a loop. I
    have tried using the count down feature in the NIDAQ MX library but it does not
    appear to be useful to me. I set it up and it will count down but once it hits
    zero it continues to count down. My expectation was that it would either
    restart the down count or it would stop. I was expecting some sort of trigger
    event to take place once the count reached the zero point but I did not observe
    any sort of event taking place. Once again my knowledge and background is
    really limited so I could be missing something really fundamental here. I have
    tried using some of the legacy functions which would enable me to do exactly
    what I want to do but they do not seem to work with my daq card. I have a NI
    PCI-6122 and if anyone has any knowledge on how to get this type of card to
    talk to some of the non MX functions I would be more than happy to hear how. It
    seems to me though, that I am limited to the MX functions which I can not
    really translate into what I have learned I can do with the legacy functions. I
    thank you all once again for taking the time to read this I and I will
    appreciate any and all responses that can be helpful.
    ~ Randy Brown

    I have run a few more tests and obtained some data per the request of a telephone support engineer. I have some scope screen shots that might be able to shed some light on what is going on. I will provide a brief description of what I discovered before I show the resulting data. I discovered that using the number of up ticks and down ticks suggested does not yield the right timing for the clock pulses that I will need for triggering my data acquisition. When I use 55 low ticks and 2 high ticks as my settings I end up getting a pulse every 32 pulses read on the PFI line. I get the same results when I interchange the numbers, for example, when I set the program up for 2 low ticks and 55 high ticks I get the same resulting one clock pulse per 32 pulses on the PFI line. I started playing with the numbers and come to find that I was able to generate a pulse every 57 pulses in this setup. I set the high ticks to 2 and the low ticks to 71 and once I did that it generated a pulse every 57 pulses in. The results are not ideal though, a number of things happen within the first second of operation. One mode of operation the clock output pulse latches after a few pulses generated. Another mode of operation that I noticed was that it would generate n number of pulses and then just stop even though the program was still running. The results I am getting are not reproducible when it comes to the long-term operation of the clock pulse generation but the bottom line is not matter what happens the end result after 1 second is not what is expected. I will show below screen shots of my program and also scope shots for the respective modes of operation.
    Front End interface
    Block Diagram
    55 High ticks and 2 low ticks results
    55 low ticks and 2 high ticks results
    77 Low ticks and 2 high ticks results
    Undesired Latch after 1 second of operation
    N number of pulses generated and stopped while program was still running
     It appears the the long term operation (and when I say long term I mean after a second) is intermittent, it either latches high or low after a random number of pulses are generated on the clock output. I am not sure why this is happening. The one setup that I came up with that generates a pulse every 57 pulses is not going to work for the setup that I have I think I would have to reduce the 71 to 69 in order to compensate for the two pulses that happen while the output pulse of the clock is high. To be honest I have no idea what is going on and I am starting to wonder about my daq card. Being that it is not really reproducing the same results I am starting to think maybe something is wrong with it. Another possibility is that it might be the bnc 2110 that I am using. I will try another one tomarrow and see if this problem persisits. I am leaving now so I won't be able to try that as of yet but I wanted to pass this info and data along such that maybe you will notice something and be able to lead me in the right direction. Thank you again for all of your help.
    ~ Randy Brown

  • Compare two cells in a ALV

    Hi!!
    I'm doing an ALV, and I need to compare two cells. Only one of them could be inform.
    I used this code:
          CLASS lcl_event_hadler DEFINITION
    CLASS lcl_event_handler DEFINITION.
      PUBLIC SECTION.
        METHODS:
          handle_data_changed
            FOR EVENT data_changed OF cl_gui_alv_grid
                IMPORTING er_data_changed.
    ENDCLASS.                    "lcl_event_handler DEFINITION
          CLASS lcl_event_handler IMPLEMENTATION
    CLASS lcl_event_handler IMPLEMENTATION.
          METHOD handle_data_changed
      METHOD handle_data_changed.
        PERFORM handle_data_changed USING er_data_changed.
      ENDMETHOD.                    "handle_data_changed
    ENDCLASS.                    "lcl_event_handler IMPLEMENTATION
    *&      Form  HANDLE_DATA_CHANGED
          text
         -->P_ER_DATA_CHANGED  text
    FORM handle_data_changed  USING    ir_data_changed
                                       TYPE REF TO
                                       cl_alv_changed_data_protocol.
      DATA: ls_mod_cell TYPE lvc_s_modi,
            lv_value    TYPE lvc_value,
            lv_value1   TYPE lvc_value.
    SORT ir_data_changed->mt_mod_cells." BY row_id.
      LOOP AT ir_data_changed->mt_mod_cells
                               INTO ls_mod_cell
                               WHERE fieldname = 'CELL2'.
        CALL METHOD ir_data_changed->get_cell_value
          EXPORTING
            i_row_id    = ls_mod_cell-row_id
            i_fieldname = 'CELL2'
          IMPORTING
            e_value     = lv_value1.
      ENDLOOP.
      LOOP AT ir_data_changed->mt_mod_cells
                              INTO ls_mod_cell
                              WHERE fieldname = 'CELL1'.
        IF it_prueba-clase IS INITIAL.
          CALL METHOD ir_data_changed->modify_cell
            EXPORTING
              i_row_id    = ls_mod_cell-row_id
              i_fieldname = ls_mod_cell-fieldname
              i_value     = campo_prueba.
        ENDIF.
        CALL METHOD ir_data_changed->get_cell_value
          EXPORTING
            i_row_id    = ls_mod_cell-row_id
            i_fieldname = 'CELL1'
          IMPORTING
            e_value     = lv_value.
        IF lv_value = lv_value1.
          CALL METHOD ir_data_changed->add_protocol_entry
            EXPORTING
              i_msgid     = 'SU'
              i_msgno     = '000'
              i_msgty     = 'E'
              i_msgv1     = 'Only one cell '
              i_fieldname = ls_mod_cell-fieldname
              i_row_id    = ls_mod_cell-row_id.
        ENDIF.
      ENDLOOP.
    ENDFORM.                    " HANDLE_DATA_CHANGED
    With this code, i can check only one time the cells. If I clear cell2 press enter, and then I write in cell2 again it code doesn't work.
    How can i do it with other method?
    Thanks in advance

    Head Crab wrote:
    Tuesdays 1st 2nd 3rd 4th 5th MB
    Jan 4, 2011 7 14 21 28 36 32
    Jan 11, 2011 5 15 25 28 38 16
    Jan 18, 2011 2 17 25 28 38 25
    Okay, say the above is my table, how do I compare two cells in a row for two numbers? Say I wanted to find out if row A2 contained a 7 and a 28?
    "A2" is an address for a single cell, not a row. Its current content, assuming no empty rows above or empty columns left of what's shown, is "Jan 4, 2011". Perhaps you mean Row 2, or the range B2:G2.
    Assuming that you want to know 'if' (or 'how many times') two specific numbers occur in the range of cells from column B to column G in a single row, COUNTIF is the function you want.
    Place the two target numbers into cell I1 and J1.
    Enter the formula below into I2:
    =COUNTIF($B2:$G2,I$1)
    Fill the formula right into J2, then fill both down to row 4.
    You'll get a count of the occurrences of each number.
    If you want only a "Yes" (both numbers appear in the range) or "No" (neither of the numbers appear, or one appears but not the other), use this variation (in I2 or J2):
    =IF(AND(COUNTIF($B2:$G2,I$1)>0,COUNTIF($B2:$G2,J$1)>0),"Yes","No")
    Regards,
    Barry

  • Compare two cells in a row and group of rows

    Tuesdays 1st 2nd 3rd 4th 5th MB
    Jan 4, 2011 7 14 21 28 36 32
    Jan 11, 2011 5 15 25 28 38 16
    Jan 18, 2011 2 17 25 28 38 25
    Okay, say the above is my table, how do I compare two cells in a row for two numbers? Say I wanted to find out if row A2 contained a 7 and a 28?
    I thought an IF formula might do it, but can't figure it out.
    Thanks in advance!
    Jim

    Head Crab wrote:
    Tuesdays 1st 2nd 3rd 4th 5th MB
    Jan 4, 2011 7 14 21 28 36 32
    Jan 11, 2011 5 15 25 28 38 16
    Jan 18, 2011 2 17 25 28 38 25
    Okay, say the above is my table, how do I compare two cells in a row for two numbers? Say I wanted to find out if row A2 contained a 7 and a 28?
    "A2" is an address for a single cell, not a row. Its current content, assuming no empty rows above or empty columns left of what's shown, is "Jan 4, 2011". Perhaps you mean Row 2, or the range B2:G2.
    Assuming that you want to know 'if' (or 'how many times') two specific numbers occur in the range of cells from column B to column G in a single row, COUNTIF is the function you want.
    Place the two target numbers into cell I1 and J1.
    Enter the formula below into I2:
    =COUNTIF($B2:$G2,I$1)
    Fill the formula right into J2, then fill both down to row 4.
    You'll get a count of the occurrences of each number.
    If you want only a "Yes" (both numbers appear in the range) or "No" (neither of the numbers appear, or one appears but not the other), use this variation (in I2 or J2):
    =IF(AND(COUNTIF($B2:$G2,I$1)>0,COUNTIF($B2:$G2,J$1)>0),"Yes","No")
    Regards,
    Barry

  • Compare two characteristics in Query

    Hi Experts,
    I have to compare two characteristics in Query fields like (A)Approved Level of Job(contain values like 01,02,03,04) and (B)Required Level of Job(contain values like 01,02,03,04).
    Now I have to do these calculations
    If A>B =1
    If A<B =0
    And also in other case
    If A=b  then value 1
    Of A =/= B then value 0
    Please let me know how I can achieve this.
    These values could be in A,B,C,D instead of 01,02,03,04 then in that case how I will calculate these comparison.
    Thanks
    Take care
    Vishal sharma

    Hi,
    i need the solution in this format on the comparison two characteristics in Query:
    0=false
    1=true
    Approved Level of Job(A)     Required Level of Job(B)      A=B         A not equal  B     A>B               A<B
         1                                                         3                                       0                         1                      0                 1
         4                                                         2                                       0                         1                      1                 0
         3                                                         3                                        1                         0                      1                 1
         5                                                         4                                       0                         1                      1                 0
         1                                                         2                                       1                         1                      0                 1
    count(A):5                        Count(B)5                                 sum 2                 sum 4           sum 3         sum 3
    so my CKF will be
    A>B/5 means 3/5=60%
    I also need to know how i am going to count A and B too.
    thanks
    take care
    vishal sharma

  • How to compare two oracle database schemas

    hi all,
    i want to compare and find out differences between two oracle databases. The comparison should be made on between table definition,table data,primary and foreign keys, packages and functions.
    Is there any management console or tool embedded in the oracle enterprise manger?
    it is really appreciate if anyone can point me towards wright direction asap.

    Hi ,
    This script would help u a lot in comparing 2 schemas and generate a report on them.
    Script:
    This script will compare two Oracle schemas and generate a report of
    discrepencies and this script has been used against Oracle 7.3.4, 8.0.5,
    REM and 8.1.7 databases, but it should also work with other versions.
    REM
    REM Please note that the following schema object types and attributes are
    REM not compared by this script at this time:
    REM
    REM cluster definitions
    REM comments on tables and columns
    REM nesting, partition, IOT, and temporary attributes of tables
    REM snapshots/materialized views, logs, and refresh groups
    REM foreign function libraries
    REM object types
    REM operators
    REM indextypes
    REM dimensions
    REM auditing information
    REM new schema attributes added for Oracle 9i
    REM
    REM Version 02-04-2002
    REM
    PROMPT
    PROMPT Schema Comparison
    PROMPT =================
    PROMPT
    PROMPT Run this script while connected to one Oracle schema. Enter the Oracle
    PROMPT username, password, and SQL*Net / Net8 service name of a second schema.
    PROMPT This script will compare the two schemas and generate a report of
    PROMPT differences.
    PROMPT
    PROMPT A temporary database link and table will be created and dropped by
    PROMPT this script.
    PROMPT
    ACCEPT schema CHAR PROMPT "Enter username for remote schema: "
    ACCEPT passwd CHAR PROMPT "Enter password for remote schema: " HIDE
    ACCEPT tnssvc CHAR PROMPT "Enter SQL*Net / Net8 service for remote schema: "
    PROMPT
    ACCEPT report CHAR PROMPT "Enter filename for report output: "
    SET FEEDBACK OFF
    SET VERIFY OFF
    CREATE DATABASE LINK rem_schema CONNECT TO &schema IDENTIFIED BY &passwd
    USING '&tnssvc';
    SET TRIMSPOOL ON
    SPOOL &report
    SELECT SUBSTR (RPAD (TO_CHAR (SYSDATE, 'mm/dd/yyyy hh24:mi:ss'), 25), 1, 25)
    "REPORT DATE AND TIME"
    FROM SYS.dual;
    COL local_schema FORMAT a35 TRUNC HEADING "LOCAL SCHEMA"
    COL remote_schema FORMAT a35 TRUNC HEADING "REMOTE SCHEMA"
    SELECT USER || '@' || C.global_name local_schema,
    A.username || '@' || B.global_name remote_schema
    FROM user_users@rem_schema A, global_name@rem_schema B, global_name C
    WHERE ROWNUM = 1;
    SET PAGESIZE 9999
    SET LINESIZE 250
    SET FEEDBACK 1
    SET TERMOUT OFF
    PROMPT
    REM Object differences
    REM ==================
    COL object_name FORMAT a30
    PROMPT SUMMARY OF OBJECTS MISSING FROM LOCAL SCHEMA
    SELECT object_type, COUNT (*)
    FROM
    SELECT object_type,
    DECODE (object_type,
    'INDEX', DECODE (SUBSTR (object_name, 1, 5),
    'SYS_C', 'SYS_C', object_name),
    'LOB', DECODE (SUBSTR (object_name, 1, 7),
    'SYS_LOB', 'SYS_LOB', object_name),
    object_name)
    FROM user_objects@rem_schema
    MINUS
    SELECT object_type,
    DECODE (object_type,
    'INDEX', DECODE (SUBSTR (object_name, 1, 5),
    'SYS_C', 'SYS_C', object_name),
    'LOB', DECODE (SUBSTR (object_name, 1, 7),
    'SYS_LOB', 'SYS_LOB', object_name),
    object_name)
    FROM user_objects
    GROUP BY object_type
    ORDER BY object_type;
    PROMPT SUMMARY OF EXTRANEOUS OBJECTS IN LOCAL SCHEMA
    SELECT object_type, COUNT (*)
    FROM
    SELECT object_type,
    DECODE (object_type,
    'INDEX', DECODE (SUBSTR (object_name, 1, 5),
    'SYS_C', 'SYS_C', object_name),
    'LOB', DECODE (SUBSTR (object_name, 1, 7),
    'SYS_LOB', 'SYS_LOB', object_name),
    object_name)
    FROM user_objects
    WHERE object_type != 'DATABASE LINK'
    OR object_name NOT LIKE 'REM_SCHEMA.%'
    MINUS
    SELECT object_type,
    DECODE (object_type,
    'INDEX', DECODE (SUBSTR (object_name, 1, 5),
    'SYS_C', 'SYS_C', object_name),
    'LOB', DECODE (SUBSTR (object_name, 1, 7),
    'SYS_LOB', 'SYS_LOB', object_name),
    object_name)
    FROM user_objects@rem_schema
    GROUP BY object_type
    ORDER BY object_type;
    PROMPT OBJECTS MISSING FROM LOCAL SCHEMA
    SELECT object_type,
    DECODE (object_type,
    'INDEX', DECODE (SUBSTR (object_name, 1, 5),
    'SYS_C', 'SYS_C', object_name),
    'LOB', DECODE (SUBSTR (object_name, 1, 7),
    'SYS_LOB', 'SYS_LOB', object_name),
    object_name) object_name
    FROM user_objects@rem_schema
    MINUS
    SELECT object_type,
    DECODE (object_type,
    'INDEX', DECODE (SUBSTR (object_name, 1, 5),
    'SYS_C', 'SYS_C', object_name),
    'LOB', DECODE (SUBSTR (object_name, 1, 7),
    'SYS_LOB', 'SYS_LOB', object_name),
    object_name) object_name
    FROM user_objects
    ORDER BY object_type, object_name;
    PROMPT EXTRANEOUS OBJECTS IN LOCAL SCHEMA
    SELECT object_type,
    DECODE (object_type,
    'INDEX', DECODE (SUBSTR (object_name, 1, 5),
    'SYS_C', 'SYS_C', object_name),
    'LOB', DECODE (SUBSTR (object_name, 1, 7),
    'SYS_LOB', 'SYS_LOB', object_name),
    object_name) object_name
    FROM user_objects
    WHERE object_type != 'DATABASE LINK'
    OR object_name NOT LIKE 'REM_SCHEMA.%'
    MINUS
    SELECT object_type,
    DECODE (object_type,
    'INDEX', DECODE (SUBSTR (object_name, 1, 5),
    'SYS_C', 'SYS_C', object_name),
    'LOB', DECODE (SUBSTR (object_name, 1, 7),
    'SYS_LOB', 'SYS_LOB', object_name),
    object_name) object_name
    FROM user_objects@rem_schema
    ORDER BY object_type, object_name;
    PROMPT OBJECTS IN LOCAL SCHEMA THAT ARE NOT VALID
    SELECT object_name, object_type, status
    FROM user_objects
    WHERE status != 'VALID'
    ORDER BY object_name, object_type;
    REM Table differences
    REM =================
    PROMPT TABLE COLUMNS MISSING FROM ONE SCHEMA
    PROMPT (NOTE THAT THIS REPORT DOES NOT LIST DISCREPENCIES IN COLUMN ORDER)
    SELECT table_name, column_name, 'Local' "MISSING IN SCHEMA"
    FROM user_tab_columns@rem_schema
    WHERE table_name IN
    SELECT table_name
    FROM user_tables
    MINUS
    SELECT table_name, column_name, 'Local' "MISSING IN SCHEMA"
    FROM user_tab_columns
    UNION ALL
    SELECT table_name, column_name, 'Remote' "MISSING IN SCHEMA"
    FROM user_tab_columns
    WHERE table_name IN
    SELECT table_name
    FROM user_tables@rem_schema
    MINUS
    SELECT table_name, column_name, 'Remote' "MISSING IN SCHEMA"
    FROM user_tab_columns@rem_schema
    ORDER BY 1, 2;
    COL schema FORMAT a15
    COL nullable FORMAT a8
    COL data_type FORMAT a9
    COL data_length FORMAT 9999 HEADING LENGTH
    COL data_precision FORMAT 9999 HEADING PRECISION
    COL data_scale FORMAT 9999 HEADING SCALE
    COL default_length FORMAT 9999 HEADING LENGTH_OF_DEFAULT_VALUE
    PROMPT DATATYPE DISCREPENCIES FOR TABLE COLUMNS THAT EXIST IN BOTH SCHEMAS
    SELECT table_name, column_name, 'Remote' schema,
    nullable, data_type, data_length, data_precision, data_scale,
    default_length
    FROM user_tab_columns@rem_schema
    WHERE (table_name, column_name) IN
    SELECT table_name, column_name
    FROM user_tab_columns
    MINUS
    SELECT table_name, column_name, 'Remote' schema,
    nullable, data_type, data_length, data_precision, data_scale,
    default_length
    FROM user_tab_columns
    UNION ALL
    SELECT table_name, column_name, 'Local' schema,
    nullable, data_type, data_length, data_precision, data_scale,
    default_length
    FROM user_tab_columns
    WHERE (table_name, column_name) IN
    SELECT table_name, column_name
    FROM user_tab_columns@rem_schema
    MINUS
    SELECT table_name, column_name, 'Local' schema,
    nullable, data_type, data_length, data_precision, data_scale,
    default_length
    FROM user_tab_columns@rem_schema
    ORDER BY 1, 2, 3;
    REM Index differences
    REM =================
    COL column_position FORMAT 999 HEADING ORDER
    PROMPT INDEX DISCREPENCIES FOR INDEXES THAT EXIST IN BOTH SCHEMAS
    SELECT A.index_name, 'Remote' schema, A.uniqueness, A.table_name,
    B.column_name, B.column_position
    FROM user_indexes@rem_schema A, user_ind_columns@rem_schema B
    WHERE A.index_name IN
    SELECT index_name
    FROM user_indexes
    AND B.index_name = A.index_name
    AND B.table_name = A.table_name
    MINUS
    SELECT A.index_name, 'Remote' schema, A.uniqueness, A.table_name,
    B.column_name, B.column_position
    FROM user_indexes A, user_ind_columns B
    WHERE B.index_name = A.index_name
    AND B.table_name = A.table_name
    UNION ALL
    SELECT A.index_name, 'Local' schema, A.uniqueness, A.table_name,
    B.column_name, B.column_position
    FROM user_indexes A, user_ind_columns B
    WHERE A.index_name IN
    SELECT index_name
    FROM user_indexes@rem_schema
    AND B.index_name = A.index_name
    AND B.table_name = A.table_name
    MINUS
    SELECT A.index_name, 'Local' schema, A.uniqueness, A.table_name,
    B.column_name, B.column_position
    FROM user_indexes@rem_schema A, user_ind_columns@rem_schema B
    WHERE B.index_name = A.index_name
    AND B.table_name = A.table_name
    ORDER BY 1, 2, 6;
    REM Constraint differences
    REM ======================
    PROMPT CONSTRAINT DISCREPENCIES FOR TABLES THAT EXIST IN BOTH SCHEMAS
    SET FEEDBACK OFF
    CREATE TABLE temp_schema_compare
    database NUMBER(1),
    object_name VARCHAR2(30),
    object_text VARCHAR2(2000),
    hash_value NUMBER
    DECLARE
    CURSOR c1 IS
    SELECT constraint_name, search_condition
    FROM user_constraints
    WHERE search_condition IS NOT NULL;
    CURSOR c2 IS
    SELECT constraint_name, search_condition
    FROM user_constraints@rem_schema
    WHERE search_condition IS NOT NULL;
    v_constraint_name VARCHAR2(30);
    v_search_condition VARCHAR2(32767);
    BEGIN
    OPEN c1;
    LOOP
    FETCH c1 INTO v_constraint_name, v_search_condition;
    EXIT WHEN c1%NOTFOUND;
    v_search_condition := SUBSTR (v_search_condition, 1, 2000);
    INSERT INTO temp_schema_compare
    database, object_name, object_text
    VALUES
    1, v_constraint_name, v_search_condition
    END LOOP;
    CLOSE c1;
    OPEN c2;
    LOOP
    FETCH c2 INTO v_constraint_name, v_search_condition;
    EXIT WHEN c2%NOTFOUND;
    v_search_condition := SUBSTR (v_search_condition, 1, 2000);
    INSERT INTO temp_schema_compare
    database, object_name, object_text
    VALUES
    2, v_constraint_name, v_search_condition
    END LOOP;
    CLOSE c2;
    COMMIT;
    END;
    SET FEEDBACK 1
    SELECT REPLACE (TRANSLATE (A.constraint_name,'012345678','999999999'),
    '9', NULL) constraint_name,
    'Remote' schema, A.constraint_type, A.table_name,
    A.r_constraint_name, A.delete_rule, A.status, B.object_text
    FROM user_constraints@rem_schema A, temp_schema_compare B
    WHERE A.table_name IN
    SELECT table_name
    FROM user_tables
    AND B.database (+) = 2
    AND B.object_name (+) = A.constraint_name
    MINUS
    SELECT REPLACE (TRANSLATE (A.constraint_name,'012345678','999999999'),
    '9', NULL) constraint_name,
    'Remote' schema, A.constraint_type, A.table_name,
    A.r_constraint_name, A.delete_rule, A.status, B.object_text
    FROM user_constraints A, temp_schema_compare B
    WHERE B.database (+) = 1
    AND B.object_name (+) = A.constraint_name
    UNION ALL
    SELECT REPLACE (TRANSLATE (A.constraint_name,'012345678','999999999'),
    '9', NULL) constraint_name,
    'Local' schema, A.constraint_type, A.table_name,
    A.r_constraint_name, A.delete_rule, A.status, B.object_text
    FROM user_constraints A, temp_schema_compare B
    WHERE A.table_name IN
    SELECT table_name
    FROM user_tables@rem_schema
    AND B.database (+) = 1
    AND B.object_name (+) = A.constraint_name
    MINUS
    SELECT REPLACE (TRANSLATE (A.constraint_name,'012345678','999999999'),
    '9', NULL) constraint_name,
    'Local' schema, A.constraint_type, A.table_name,
    A.r_constraint_name, A.delete_rule, A.status, B.object_text
    FROM user_constraints@rem_schema A, temp_schema_compare B
    WHERE B.database (+) = 2
    AND B.object_name (+) = A.constraint_name
    ORDER BY 1, 4, 2;
    REM Database link differences
    REM =========================
    PROMPT DATABASE LINK DISCREPENCIES
    COL db_link FORMAT a40
    SELECT db_link, 'Remote' schema, username, host
    FROM user_db_links@rem_schema
    MINUS
    SELECT db_link, 'Remote' schema, username, host
    FROM user_db_links
    UNION ALL
    SELECT db_link, 'Local' schema, username, host
    FROM user_db_links
    WHERE db_link NOT LIKE 'REM_SCHEMA.%'
    MINUS
    SELECT db_link, 'Local' schema, username, host
    FROM user_db_links@rem_schema
    ORDER BY 1, 2;
    REM Sequence differences
    REM ====================
    PROMPT SEQUENCE DISCREPENCIES
    SELECT sequence_name, 'Remote' schema, min_value, max_value,
    increment_by, cycle_flag, order_flag, cache_size
    FROM user_sequences@rem_schema
    MINUS
    SELECT sequence_name, 'Remote' schema, min_value, max_value,
    increment_by, cycle_flag, order_flag, cache_size
    FROM user_sequences
    UNION ALL
    SELECT sequence_name, 'Local' schema, min_value, max_value,
    increment_by, cycle_flag, order_flag, cache_size
    FROM user_sequences
    MINUS
    SELECT sequence_name, 'Local' schema, min_value, max_value,
    increment_by, cycle_flag, order_flag, cache_size
    FROM user_sequences@rem_schema
    ORDER BY 1, 2;
    REM Private synonym differences
    REM ===========================
    PROMPT PRIVATE SYNONYM DISCREPENCIES
    SELECT synonym_name, 'Remote' schema, table_owner, table_name, db_link
    FROM user_synonyms@rem_schema
    MINUS
    SELECT synonym_name, 'Remote' schema, table_owner, table_name, db_link
    FROM user_synonyms
    UNION ALL
    SELECT synonym_name, 'Local' schema, table_owner, table_name, db_link
    FROM user_synonyms
    MINUS
    SELECT synonym_name, 'Local' schema, table_owner, table_name, db_link
    FROM user_synonyms@rem_schema
    ORDER BY 1, 2;
    REM PL/SQL differences
    REM ==================
    PROMPT SOURCE CODE DISCREPENCIES FOR PACKAGES, PROCEDURES, AND FUNCTIONS
    PROMPT THAT EXIST IN BOTH SCHEMAS
    SELECT name, type, COUNT (*) discrepencies
    FROM
    SELECT name, type, line, text
    FROM user_source@rem_schema
    WHERE (name, type) IN
    SELECT object_name, object_type
    FROM user_objects
    MINUS
    SELECT name, type, line, text
    FROM user_source
    UNION ALL
    SELECT name, type, line, text
    FROM user_source
    WHERE (name, type) IN
    SELECT object_name, object_type
    FROM user_objects@rem_schema
    MINUS
    SELECT name, type, line, text
    FROM user_source@rem_schema
    GROUP BY name, type
    ORDER BY name, type;
    PROMPT SOURCE CODE DISCREPENCIES FOR PACKAGES, PROCEDURES, AND FUNCTIONS
    PROMPT THAT EXIST IN BOTH SCHEMAS (CASE INSENSITIVE COMPARISON)
    SELECT name, type, COUNT (*) discrepencies
    FROM
    SELECT name, type, line, UPPER (text)
    FROM user_source@rem_schema
    WHERE (name, type) IN
    SELECT object_name, object_type
    FROM user_objects
    MINUS
    SELECT name, type, line, UPPER (text)
    FROM user_source
    UNION ALL
    SELECT name, type, line, UPPER (text)
    FROM user_source
    WHERE (name, type) IN
    SELECT object_name, object_type
    FROM user_objects@rem_schema
    MINUS
    SELECT name, type, line, UPPER (text)
    FROM user_source@rem_schema
    GROUP BY name, type
    ORDER BY name, type;
    REM Trigger differences
    REM ===================
    PROMPT TRIGGER DISCREPENCIES
    SET FEEDBACK OFF
    TRUNCATE TABLE temp_schema_compare;
    DECLARE
    CURSOR c1 IS
    SELECT trigger_name, trigger_body
    FROM user_triggers;
    CURSOR c2 IS
    SELECT trigger_name, trigger_body
    FROM user_triggers@rem_schema;
    v_trigger_name VARCHAR2(30);
    v_trigger_body VARCHAR2(32767);
    v_hash_value NUMBER;
    BEGIN
    OPEN c1;
    LOOP
    FETCH c1 INTO v_trigger_name, v_trigger_body;
    EXIT WHEN c1%NOTFOUND;
    v_trigger_body := REPLACE (v_trigger_body, ' ', NULL);
    v_trigger_body := REPLACE (v_trigger_body, CHR(9), NULL);
    v_trigger_body := REPLACE (v_trigger_body, CHR(10), NULL);
    v_trigger_body := REPLACE (v_trigger_body, CHR(13), NULL);
    v_trigger_body := UPPER (v_trigger_body);
    v_hash_value := dbms_utility.get_hash_value (v_trigger_body, 1, 65536);
    INSERT INTO temp_schema_compare (database, object_name, hash_value)
    VALUES (1, v_trigger_name, v_hash_value);
    END LOOP;
    CLOSE c1;
    OPEN c2;
    LOOP
    FETCH c2 INTO v_trigger_name, v_trigger_body;
    EXIT WHEN c2%NOTFOUND;
    v_trigger_body := REPLACE (v_trigger_body, ' ', NULL);
    v_trigger_body := REPLACE (v_trigger_body, CHR(9), NULL);
    v_trigger_body := REPLACE (v_trigger_body, CHR(10), NULL);
    v_trigger_body := REPLACE (v_trigger_body, CHR(13), NULL);
    v_trigger_body := UPPER (v_trigger_body);
    v_hash_value := dbms_utility.get_hash_value (v_trigger_body, 1, 65536);
    INSERT INTO temp_schema_compare (database, object_name, hash_value)
    VALUES (2, v_trigger_name, v_hash_value);
    END LOOP;
    CLOSE c2;
    END;
    SET FEEDBACK 1
    SELECT A.trigger_name, 'Local' schema, A.trigger_type,
    A.triggering_event, A.table_name, SUBSTR (A.referencing_names, 1, 30)
    referencing_names, SUBSTR (A.when_clause, 1, 30) when_clause,
    A.status, B.hash_value
    FROM user_triggers A, temp_schema_compare B
    WHERE B.object_name (+) = A.trigger_name
    AND B.database (+) = 1
    AND A.table_name IN
    SELECT table_name
    FROM user_tables@rem_schema
    MINUS
    SELECT A.trigger_name, 'Local' schema, A.trigger_type,
    A.triggering_event, A.table_name, SUBSTR (A.referencing_names, 1, 30)
    referencing_names, SUBSTR (A.when_clause, 1, 30) when_clause,
    A.status, B.hash_value
    FROM user_triggers@rem_schema A, temp_schema_compare B
    WHERE B.object_name (+) = A.trigger_name
    AND B.database (+) = 2
    UNION ALL
    SELECT A.trigger_name, 'Remote' schema, A.trigger_type,
    A.triggering_event, A.table_name, SUBSTR (A.referencing_names, 1, 30)
    referencing_names, SUBSTR (A.when_clause, 1, 30) when_clause,
    A.status, B.hash_value
    FROM user_triggers@rem_schema A, temp_schema_compare B
    WHERE B.object_name (+) = A.trigger_name
    AND B.database (+) = 2
    AND A.table_name IN
    SELECT table_name
    FROM user_tables
    MINUS
    SELECT A.trigger_name, 'Remote' schema, A.trigger_type,
    A.triggering_event, A.table_name, SUBSTR (A.referencing_names, 1, 30)
    referencing_names, SUBSTR (A.when_clause, 1, 30) when_clause,
    A.status, B.hash_value
    FROM user_triggers A, temp_schema_compare B
    WHERE B.object_name (+) = A.trigger_name
    AND B.database (+) = 1
    ORDER BY 1, 2, 5, 3;
    REM View differences
    REM ================
    PROMPT VIEW DISCREPENCIES
    SET FEEDBACK OFF
    TRUNCATE TABLE temp_schema_compare;
    DECLARE
    CURSOR c1 IS
    SELECT view_name, text
    FROM user_views;
    CURSOR c2 IS
    SELECT view_name, text
    FROM user_views@rem_schema;
    v_view_name VARCHAR2(30);
    v_text VARCHAR2(32767);
    v_hash_value NUMBER;
    BEGIN
    OPEN c1;
    LOOP
    FETCH c1 INTO v_view_name, v_text;
    EXIT WHEN c1%NOTFOUND;
    v_text := REPLACE (v_text, ' ', NULL);
    v_text := REPLACE (v_text, CHR(9), NULL);
    v_text := REPLACE (v_text, CHR(10), NULL);
    v_text := REPLACE (v_text, CHR(13), NULL);
    v_text := UPPER (v_text);
    v_hash_value := dbms_utility.get_hash_value (v_text, 1, 65536);
    INSERT INTO temp_schema_compare (database, object_name, hash_value)
    VALUES (1, v_view_name, v_hash_value);
    END LOOP;
    CLOSE c1;
    OPEN c2;
    LOOP
    FETCH c2 INTO v_view_name, v_text;
    EXIT WHEN c2%NOTFOUND;
    v_text := REPLACE (v_text, ' ', NULL);
    v_text := REPLACE (v_text, CHR(9), NULL);
    v_text := REPLACE (v_text, CHR(10), NULL);
    v_text := REPLACE (v_text, CHR(13), NULL);
    v_text := UPPER (v_text);
    v_hash_value := dbms_utility.get_hash_value (v_text, 1, 65536);
    INSERT INTO temp_schema_compare (database, object_name, hash_value)
    VALUES (2, v_view_name, v_hash_value);
    END LOOP;
    CLOSE c2;
    END;
    SET FEEDBACK 1
    SELECT A.view_name, 'Local' schema, B.hash_value
    FROM user_views A, temp_schema_compare B
    WHERE B.object_name (+) = A.view_name
    AND B.database (+) = 1
    AND A.view_name IN
    SELECT view_name
    FROM user_views@rem_schema
    MINUS
    SELECT A.view_name, 'Local' schema, B.hash_value
    FROM user_views@rem_schema A, temp_schema_compare B
    WHERE B.object_name (+) = A.view_name
    AND B.database (+) = 2
    UNION ALL
    SELECT A.view_name, 'Remote' schema, B.hash_value
    FROM user_views@rem_schema A, temp_schema_compare B
    WHERE B.object_name (+) = A.view_name
    AND B.database (+) = 2
    AND A.view_name IN
    SELECT view_name
    FROM user_views
    MINUS
    SELECT A.view_name, 'Remote' schema, B.hash_value
    FROM user_views A, temp_schema_compare B
    WHERE B.object_name (+) = A.view_name
    AND B.database (+) = 1
    ORDER BY 1, 2;
    REM Job queue differences
    REM =====================
    COL what FORMAT a30
    COL interval FORMAT a30
    PROMPT JOB QUEUE DISCREPENCIES
    SELECT what, interval, 'Remote' schema
    FROM user_jobs@rem_schema
    MINUS
    SELECT what, interval, 'Remote' schema
    FROM user_jobs
    UNION ALL
    SELECT what, interval, 'Local' schema
    FROM user_jobs
    MINUS
    SELECT what, interval, 'Local' schema
    FROM user_jobs@rem_schema
    ORDER BY 1, 2, 3;
    REM Privilege differences
    REM =====================
    PROMPT OBJECT-LEVEL GRANT DISCREPENCIES
    SELECT owner, table_name, 'Remote' schema, grantee, privilege, grantable
    FROM user_tab_privs@rem_schema
    WHERE (owner, table_name) IN
    SELECT owner, object_name
    FROM all_objects
    MINUS
    SELECT owner, table_name, 'Remote' schema, grantee, privilege, grantable
    FROM user_tab_privs
    UNION ALL
    SELECT owner, table_name, 'Local' schema, grantee, privilege, grantable
    FROM user_tab_privs
    WHERE (owner, table_name) IN
    SELECT owner, object_name
    FROM all_objects@rem_schema
    MINUS
    SELECT owner, table_name, 'Local' schema, grantee, privilege, grantable
    FROM user_tab_privs@rem_schema
    ORDER BY 1, 2, 3;
    PROMPT SYSTEM PRIVILEGE DISCREPENCIES
    SELECT privilege, 'Remote' schema, admin_option
    FROM user_sys_privs@rem_schema
    MINUS
    SELECT privilege, 'Remote' schema, admin_option
    FROM user_sys_privs
    UNION ALL
    SELECT privilege, 'Local' schema, admin_option
    FROM user_sys_privs
    MINUS
    SELECT privilege, 'Local' schema, admin_option
    FROM user_sys_privs@rem_schema
    ORDER BY 1, 2;
    PROMPT ROLE PRIVILEGE DISCREPENCIES
    SELECT granted_role, 'Remote' schema, admin_option, default_role, os_granted
    FROM user_role_privs@rem_schema
    MINUS
    SELECT granted_role, 'Remote' schema, admin_option, default_role, os_granted
    FROM user_role_privs
    UNION ALL
    SELECT granted_role, 'Local' schema, admin_option, default_role, os_granted
    FROM user_role_privs
    MINUS
    SELECT granted_role, 'Local' schema, admin_option, default_role, os_granted
    FROM user_role_privs@rem_schema
    ORDER BY 1, 2;
    SPOOL OFF
    SET TERMOUT ON
    PROMPT
    PROMPT Report output written to &report
    SET FEEDBACK OFF
    DROP TABLE temp_schema_compare;
    DROP DATABASE LINK rem_schema;
    SET FEEDBACK 6
    SET PAGESIZE 20
    SET LINESIZE 80

  • REGEXP_ compare two tokenized strings

    Hi,
    I need to compare two fields (from two tables), to see if any of the tokenized contents match.
    I have two tables with a "name" field, but the names might be incomplete or in random order. To get a match, I just need 1 part of both to really match, for example "John Doe" should match to "Doe J.".
    Something like:
    SELECT names1.name, names2.name
    FROM names1, names2
    WHERE INSTR(names1.name, REGEXP_SUBSTR(names2.name, '[[:alpha:]]+')) > 0
    But the statement should consider all tokens, not just the first one as in the example.
    Any suggestion on how to achieve this?
    Thanks,
    K.

    The performance of the regexp_instr in the where clause is terrible ... I stopped working out other scenarios, because the conclusion will be the same:
    SQL> create table names1
      2  as
      3  select 1 id, 'John Doe' name from dual union all
      4  select 2, 'Larry Ellison' from dual union all
      5  select 3, 'Catharina-Amalia Beatrix Carmen Victoria van Oranje' from dual union all
      6  select object_id, o
      7    from ( select object_id
      8                , owner || object_name o
      9                , ntile(200) over (order by object_id) nt
    10             from all_objects
    11         )
    12   where nt = 11
    13  /
    Tabel is aangemaakt.
    SQL> create table names2
      2  as
      3  select 1001 id, 'Doe J.' name from dual union all
      4  select 1002, 'Gates Bill' from dual union all
      5  select 1003, 'Beatrix Wilhelmina Armgard van Oranje' from dual union all
      6  select object_id, o
      7    from ( select object_id
      8                , owner || object_name o
      9                , ntile(200) over (order by object_id) nt
    10             from all_objects
    11         )
    12   where nt = 22
    13  /
    Tabel is aangemaakt.
    SQL> select count(*) from names1
      2  /
      COUNT(*)
           241
    1 rij is geselecteerd.
    SQL> select count(*) from names2
      2  /
      COUNT(*)
           241
    1 rij is geselecteerd.
    SQL> exec dbms_stats.gather_table_stats(user,'names1')
    PL/SQL-procedure is geslaagd.
    SQL> exec dbms_stats.gather_table_stats(user,'names2')
    PL/SQL-procedure is geslaagd.
    SQL> set timing on
    SQL> set autotrace on
    SQL> select distinct n1.original_name name1
      2       , n2.original_name name2
      3    from ( select id
      4                , name
      5                , original_name
      6             from names1
      7            model
      8                  return updated rows
      9                  partition by (id)
    10                  dimension by (0 i)
    11                  measures (' ' || name || ' ' name, cast(null as varchar2(100)) original_name)
    12                  rules iterate (100) until (iteration_number = length(regexp_replace(name[0],'[^ ]')) - 2)
    13                  ( name[iteration_number+1] = regexp_substr(name[0],'[^ ]+',1,iteration_number+1)
    14                  , original_name[iteration_number+1] = trim(name[0])
    15                  )
    16         ) n1
    17       , ( select id
    18                , name
    19                , original_name
    20             from names2
    21            model
    22                  return updated rows
    23                  partition by (id)
    24                  dimension by (0 i)
    25                  measures (' ' || name || ' ' name, cast(null as varchar2(100)) original_name)
    26                  rules iterate (100) until (iteration_number = length(regexp_replace(name[0],'[^ ]')) - 2)
    27                  ( name[iteration_number+1] = regexp_substr(name[0],'[^ ]+',1,iteration_number+1)
    28                  , original_name[iteration_number+1] = trim(name[0])
    29                  )
    30         ) n2
    31   where n1.name = n2.name
    32  /
    NAME1
    NAME2
    Catharina-Amalia Beatrix Carmen Victoria van Oranje
    Beatrix Wilhelmina Armgard van Oranje
    John Doe
    Doe J.
    2 rijen zijn geselecteerd.
    Verstreken: 00:00:00.07
    Uitvoeringspan
       0      SELECT STATEMENT Optimizer=CHOOSE (Cost=8 Card=581 Bytes=987
              70)
       1    0   SORT (UNIQUE) (Cost=8 Card=581 Bytes=98770)
       2    1     HASH JOIN (Cost=7 Card=581 Bytes=98770)
       3    2       VIEW (Cost=3 Card=241 Bytes=20485)
       4    3         BUFFER (SORT)
       5    4           SQL MODEL (ORDERED FAST)
       6    5             TABLE ACCESS (FULL) OF 'NAMES1' (TABLE) (Cost=3
              Card=241 Bytes=5784)
       7    2       VIEW (Cost=3 Card=241 Bytes=20485)
       8    7         BUFFER (SORT)
       9    8           SQL MODEL (ORDERED FAST)
      10    9             TABLE ACCESS (FULL) OF 'NAMES2' (TABLE) (Cost=3
              Card=241 Bytes=5784)
    Statistics
            387  recursive calls
              0  db block gets
             52  consistent gets
              0  physical reads
              0  redo size
            590  bytes sent via SQL*Net to client
            508  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
             11  sorts (memory)
              0  sorts (disk)
              2  rows processed
    SQL> select n1.name name1
      2       , n2.name name2
      3    from names1 n1
      4       , names2 n2
      5   where regexp_instr  ( ' ' || n1.name || ' ',       ' ' || replace( n2.name, ' ', ' | ' ) || ' '  ) > 0
      6  /
    NAME1                                                        NAME2
    John Doe                                                     Doe J.
    Catharina-Amalia Beatrix Carmen Victoria van Oranje          Beatrix Wilhelmina Armgard van Oranje
    2 rijen zijn geselecteerd.
    Verstreken: 00:00:46.54
    Uitvoeringspan
       0      SELECT STATEMENT Optimizer=CHOOSE (Cost=218 Card=2904 Bytes=
              121968)
       1    0   NESTED LOOPS (Cost=218 Card=2904 Bytes=121968)
       2    1     TABLE ACCESS (FULL) OF 'NAMES1' (TABLE) (Cost=3 Card=241
               Bytes=5061)
       3    1     TABLE ACCESS (FULL) OF 'NAMES2' (TABLE) (Cost=1 Card=12
              Bytes=252)
    Statistics
              1  recursive calls
              0  db block gets
            728  consistent gets
              0  physical reads
              0  redo size
            590  bytes sent via SQL*Net to client
            508  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
              2  rows processedRegards,
    Rob.

  • How to compare two Universes of two different Datamarts?

    Post Author: Shrikant
    CA Forum: Integrated Solutions
    Hi.. all I want to compare two universes of different data mart to check the table structure. Can anybody please tell me how to compare two Universes of different Datamarts?How i can achive this usinig BusinessObjects Enterprise XI Release 2 ??
    Thanks in advance.

    /*does record 1 have friend*/
    WITH t AS
    (SELECT 1 AS Id, 'a' AS NAME, 'type1' AS Col
      FROM Dual
      UNION ALL
      SELECT 2 AS Id, 'a' AS NAME, 'type1' AS Col
      FROM Dual
      UNION ALL
      SELECT 3 AS Id, 'a' AS NAME, 'type2' AS Col FROM Dual)
    SELECT count(*) as YesNo
    FROM t T1
    WHERE T1.Id = 1
          AND (T1.Name, T1.Col) IN (SELECT T2.Name, T2.Col FROM T t2 where t2.ID != T1.Id);
         1
    /*does record 3 have friend*/
    WITH t AS
    (SELECT 1 AS Id, 'a' AS NAME, 'type1' AS Col
      FROM Dual
      UNION ALL
      SELECT 2 AS Id, 'a' AS NAME, 'type1' AS Col
      FROM Dual
      UNION ALL
      SELECT 3 AS Id, 'a' AS NAME, 'type2' AS Col FROM Dual)
    SELECT count(*) as YesNo
    FROM t T1
    WHERE T1.Id = 3
       AND (T1.Name, T1.Col) IN (SELECT T2.Name, T2.Col FROM T t2 where t2.ID != T1.Id);
         0
    */

  • Good day. Is there into Pages the possibility to compare two documents? In order to reveal changes.

    Good day. Is there into Pages the possibility to compare two documents? In order to reveal changes.

    Hi iMayner,
    I don't know of a way to easily compare two documents in Pages. Maybe there is an app to do this, but I don't know of one.
    What you can do in Pages is to open both documents, resize the windows and drag them side-by-side on the screen. Pages 5 has a limit on how narrow you can make the windows, so this may be a bit of a pain.
    The first step would be to show the Word Count in both documents. (Pages 5.5.1 Menu > View > Show Word Count, or click on the View button in the ToolBar and Show Word Count). If the Word Counts are the same, you have **some** confidence that the documents are identical, but no guarantee.
    An example of two short documents with different word counts:
    Document A (33 words)
    The quick brown fox jumps over the lazy dog.
    Don't count your chickens until they hatch.
    Don't cross your bridges until you come to them.
    An apple a day keeps the doctor away.
    Document B (34 words)
    The quick brown fox jumps over the lazy dog.
    Don't count your chickens until they have hatched.
    Don't cross your bridges until you come to them.
    An apple a day keeps the doctor away.
    To home in on that difference, copy and paste each document into a column in a spreadsheet such as Numbers or Excel, so that each paragraph becomes a cell in a column. Turn on Wrap text in cell.
    The different heights of each cell (paragraph) become apparent.
    Happy Christmas!
    Regards,
    Ian.

  • Pulse count fieldpoint

    Hi! I need to write a VI with a pulse counter employing fieldpoint. Here's my problem: I have an energy meter with pulse output. I can set pulse frequency, pulse lenght and number of pulses for kWh. I have to read the signal from that instrument but I don't really understand how. I mean, I do not have to measure the frequency of the pulses 'cos I already set it, I'd rather read the signal from the meter in a specified period of time and count the number of pulses in that time. How can I do that?
    I can both connect the meter to a cFP AI-110 or cFP CTR500. There are mainly two things I don't understand:
    -how can I count the pulses in, let's say, 30 s?
    -how can I define the reset condition?
    Thanks!
    Valeria

    Valeria,
    CTR500 is the best solution.  Have you verified that the pulses from the energy meter are compatible with CTR500 inputs?  If so, the two counter method will give you the best results.  The first counter creates a window of known width which is then used to enable another counter that counts the pulses.  There is an example .vi that ships with LV called "Frequency Measurement.vi" that demonstrates the 2 counter method.  Instead of calculating frequency you will need to calculate energy.

  • How to compare two signals

    I would like to compare two singals from NI-DAQ (ch0) and NI-Function generator (ch1).
    One(ch0) is 500 Hz and the other(ch1) is a little bit complex (sine and then square pulse 250 times faster than 500Hz).
    In so many times, I tried to get a trigger mode in ch0 or ch1.
    The comparison points of two signals are starting and ending point(phase) to check the synchronization.
    Is it possible to compare them by oscilloscope?
    Is there a suitable instrument to compare them conveniently?
    Best,
    labmaster.

    Hello labmaster,
    Could you tell me a little more about what you are trying to do? What devices are you using to generate your signals, and where are you trying to start and stop the aquisition? The way you would go about triggering on a 3rd party oscilloscpe will depend on the triggering options supported by that scope.
    If a pure hardware-defined oscilloscope does not give you the kind of triggering you need, you might consider looking into using a NI digitizer. Not only do our digitzers support a large variety of triggering methods, you will be able to choose which samples to display through use of LabVIEW. 
    -Abram

  • Compare two different iPhoto Libraries

    Is there any program that could compare two iPhoto Libraries and let me know the difference between them? I've got two libraries, they should have the same pictures, but for some reason one is 80GB bigger than the other one.
    I know there are duplicates, but 80GB seems a lot for only duplicates, so I want to compare both of them and see what pictures are missing.

    How many photos does iPhoto indicate in each of the libraries? Open the Photo mode, do a select all and see how many are indicated at the bottom of the window. See if that corresponds to the number beside the Photos icon under the Events library. Be sure to turn on Item Counts in iPhoto's General preference pane.
    Which is the larger: the old or the new?
    OT

  • How to Compare Two Strng without .equals() method

    Hiii,
    How to compare two Strings with out .equals method if there are white spaces in between these string it should be avoided..
    eg: ab cd ef g is equal to a bc de fg
    Please give me the logic or code..
    Your help will be appreciated

    dude find the code without the equal method
    public class test {     
         public static void main(String args[])
              String str = "ab cd ef g" ;
              String str1 = "a bc de fg";
              char []ch = str.toCharArray();
              char []ch1 = str1.toCharArray();
              int counter =0, counter1 = 0;
              while(counter < ch.length && counter1 < ch1.length)
                   while(ch[counter]==' ')
                        counter++;
                   while(ch1[counter1]==' ')
                        counter1++;
                   if(ch[counter] != ch1[counter1])
                        break;
                   counter++; counter1++;
              if(counter == ch.length && counter1 == ch1.length)
                   System.out.println("true");
              else
                   System.out.println("false");
    }

  • Trigged generation of two pulse trains

    I have to write an application that will generate two equal pulse trains (with a given phase difference) on two different counters when I recieve a trigger signal. I'm using a 6063daq-card. If anyone have an related example, or some hint on how to solve this (elementary problem) please let me know.

    Hi OG,
    Although this functionality is present on NI-TIO counter/timer chips (NI-660x boards) by use of an initial delay within the counters (could program a delay equal to the desired phase shift) this is not available on DAQ-STC chips (E Series boards). This is because DAQ-STC counters do not support an initial delay in pulse train generation mode (driver doesn't support it).
    The only way I see this happening is if you use the frequency generator on the E Series to generate your first pulse train (output on the freq_out pin) and use your two main counters to generate 1) a triggered and delayed pulse which will gate 2) your second counter which is a pulse train of the same frequency. To get the phase correct, your delay of the pulse should be equal to t
    he desired phase shift of your pulse train period and should be gated/triggered by one of the rising edges of your frequency generator pulse train. The actual pulse width of this single pulse should be made as large as possible (or should toggle the output - see the 2nd knowledge base linked below). I have included a couple good references to get you started. Hope that helps. Have a good day.
    How Can I Generate Two Pulse Trains without Using Both Counters on My E-series Data Acquisition Board?
    http://digital.ni.com/public.nsf/ websearch/ 129541C85CEEDDBF86256ADF005C4409?OpenDoc ument
    Using the General Purpose Counter (GPCTR) on the Data Acquisition (DAQ) Device as a Digital Line
    http://digital.ni.com/public.nsf/ websearch/ B8A49A4E33F38AB686256B610061DC6D?OpenDoc ument
    Ron
    Applications Engineering
    National Instruments

Maybe you are looking for