Wrong results using quadrature encoders with NI DAQCard-6036E

     Hello,
I'm experiencing some troubles using two quadrature encoders with a NI multifunction I/O.
The encoders are Micro-Epsilon WDS-7500-P115-CR-TTL. They are incremental encoders in TTL logic. They are connected to a HP laptop running Windows XP Professional. The connection is via the multifunction I/O NI DAQCard-6036E. Each encoder is connected to the DAQ board with four wires: +5V, DGND, track A, track B. I used the system in my office for a while and everything was fine. Then I moved it in another place and now it shows a fuzzy behaviour.
I made the following tests:
Test 1) I connect track A&B to analog inputs on the DAQ card. Then I use SignalExpress v2.5 to perform a DAQmx analog input acquisition. The waveforms I get are exactly as expected.
Test 2) I connect track A to the counter source and I leave track B disconnected. I use SignalExpress v2.5 to set a DAQmx edge counter, with the "Count up" option enabled. Also this test is fine. When I pull the encoder cable I get +N counts and when I release the cable it goes back to zero position, giving other +N counts.
Test 3) I connect track A to the counter source and track B to P0.6 (or P0.7 for the second encoder), which is the pin used to control the count direction. I use SignalExpress v2.5 to set a DAQmx edge counter, with "Count up". In this way the DAQ should ignore track B and count always up. Actually it does, but the count rate in one direction is double with respect to the count rate in the other direction. This means that when I pull the encoder cable I get +N counts and when I put it back to initial position I get other +2N counts. In this way the counter indicates +3N at the end, while it should be +2N.
Test 4) I connect track A to the counter source and track B to P0.6 (or P0.7 for the second encoder). I use SignalExpress v2.5 to set an "Externally controlled" DAQmx edge counter. Now I get +N counts when I pull the encoder and -2N counts when I put it back to zero position. In this way the counter indicates -N  at the end, while it should be zero.
Test 5) I repeat test 4 using LabWindows/CVI v8.1 and I get the same result.
Test 6) I swap lines A&B. Now track B is connected to the counter source and track A goes to P0.6 (or P0.7 for the second encoder). Using SignalExpress to perform an "External controlled" count, I get +2N counts when I pull the encoder and -N counts when I put it back to zero. So, at the end the counter indicates +N, but it should be zero.
Do you have any idea on how to solve the problem? Thank you very much in advance.

A few things:
1. I'm not from NI and won't try to speak for them.  But I don't believe these forums are meant as a primary means of support, probably not an *official* means of support at all.  Most of the folks here (like me) are NI's more-or-less satisfied customers, not employees.   If you buy a service contract, you can get instant phone support.  If you rely on free support from the forums, I think you'll get good help most of the time, but there's just no guarantee. 
2. "I just got a [email] reply from MicroEpsilon.  The encoders work fine."   Um.  Based on what, exactly?  Of *course* they will expect their own stuff to be just fine, and in fact I very much suspect they're right.  But NI will expect their board to be just fine, and I expect they're right too.  Or at least it was fine *before* you hooked things up.  Leading us to #3.
3.  Part of the app note on Quad Encoders on E-series boards warns against connecting differential encoder outputs directly to your board.  I think it mentions that a 24V differential (for example) can damage the board.  But even a low-voltage differential signal isn't electrically *compatible* with your counter inputs.  Your first posting claimed that the encoders produced TTL.  Your June 30 post referred to inverted A and B signals for rejecting common mode noise over long transmission lines.  These are classic code words that scream "differential output", *not* TTL.  So now we can start addressing some specific tech issues.
4. Your E-series board is not inherently capable of handling true quadrature, as the app note says.  (The newer M-series multifunction boards *do* have the capability.)  You can get kinda sorta close, but you'll be at risk of count errors due to direction changes or during vibrations when otherwise stationary.
5. You will also need some type of differential to TTL conversion on your (A, /A) and (B, /B) pairs.
6. You will need a common "ground" reference for all your digital signals (probably not a true earth ground).  So the ground for your conversion circuit and its TTL outputs must be tied to your DAQ board digital ground.  Also the return terminal from any related external power supply.  Sounds like failure to do this had been an issue with a past implementation of yours so perhaps it's an additional factor at play this time too?
7.  What are you trying to measure?  For what purpose?  What decision is made from the data?  How much do you care about its accuracy?  These are leading questions, but I'm suggesting that meeting schedule with an unreliable app that produces untrustworthy data just might not be the best goal to strive for right now.  If you care to maintain accurate position count despite direction changes or vibrations, you *need* something more than your E-series board.  If you want reliable edge counting operation with *any* DAQ board, you *need* electrically compatible signals.
-Kevin P.

Similar Messages

  • Using quadrature encoders with PXI-6025

    Hi!,
    We are using an encoder for position data. The encoder gives A and B pulses which are phase shifted by 90 deg.
    Grating Pitch = 40 microns
    We make the connection to our PXI-6025 as such:
    Channel A pulse goes to PFI 8 (GPCTR_Source)
    Channel B pulse goes to DIO6 (GP_Up_Down)
    Ground goes to DGND
    We are able to increment/decrement the counter on our 6025 for every 40 micron movement
    However, we are unable to quad the input and increment/decrement for every 10 microns. How do we achieve this?
    We have an electronic circuit which converts the 40 micron A and B pulse from the encoder into 4 pulses spaced at 10 microns. But, using this single pulse mode does not allow for up/down counting.
    We are using LV-7.1
    , NI-DAQ 7.2 and Win2000 prof.
    Looking forward to some quick help.
    Thanks,
    Gurdas
    Gurdas Singh
    PhD. Candidate | Civil Engineering | NCSU.edu

    There's one tedious way that might work if you only need to post-process the data. However there are several possible problems.
    The idea is to perform buffered semi-period measurements with both the counters on the 6025. Once you've collected all the needed semi-period data, perform a cumulative sum of each array so you end up with timestamps for all the transitions. Then you'll need to go through them to distinguish (+) from (-) direction quadrature transitions and generate a cumulative position array.
    I don't think there's another way -- only semiperiod measurements will react to both edges of an incoming pulse train. However, it *is* possible in principle to get your 4x factor in resolution. Now for the problem list:
    1. Your 6025E only has 1 DMA channel. One of the counters will have to be configured to use interrupts, which in turn will limit the maximum encoder rate you can track. I wouldn't count on tracking better than single digits of kHz, and you may not even be able to achieve that much.
    2. The last time I did semiperiods on an E-series board, there was no way to specify which edge would mark the first recognized transition. If the input was low when you started, the first transition recorded would be a rising edge; if high, then a falling edge.
    Knowledge of the initial state of the inputs is critical for your software quadrature decoding. I think the solution I used was to parallel wire the A&B channels to a couple DIO pins which I inspected before any encoder motion started. If your encoder jitters or vibrates about its nominal position however, you're probably hosed.
    Are you sure you can't use the LS7084 to replace your other external circuit? The alternatives are either going to be trouble-prone gimmicks like I described above or the purchase of new DAQ equipment.
    If you have budget for new DAQ equipment from NI, I'd suggest you look into one of the following:
    1. Low-cost M series multi-function board
    These have 2 32-bit counters onboard that are capable of quadrature decode. Each counter gets its own DMA channel for buffered acquisition. Plus you get a bunch of analog in, timed digital i/o, and can get analog outs. The boards are $475 with 2 analog outputs, $375 with none.
    2. dedicated counter/timer board
    The 6601 is cheaper at $295, but is limited to 1 DMA channel and has a slower onboard timing clock. The 6602 costs about double that but gives you somewhat more than double capability.
    -Kevin P.

  • Using Quadrature encoders

    Hi,
    I'm using a quadrature encoders with a PCI6025E board to measure an angle,
    I want to use the COUNTER1 so I have connected line A of the encoder to PFI_3 and Line B of the encoder to LINE DIO7.
    I have configure the 6025E with this code to read the counter 1 value :
    status = GPCTR_Control(1, ND_COUNTER_1, ND_RESET);
    status = GPCTR_Set_Application(1, ND_COUNTER_1, ND_SIMPLE_EVENT_CNT);
    status = GPCTR_Change_Parameter(1, ND_COUNTER_1, ND_SOURCE, ND_PFI_3);
    status = GPCTR_Change_Parameter(1, ND_COUNTER_1, ND_UP_DOWN,ND_HARDWARE);
    status = GPCTR_Control(1, ND_COUNTER_1, ND_PROGRAM);
    All the status code return by this functions are 0 and so OK.
    But when I Get the counter value with GPCTR_Wathch().
    When i tur
    n the encoder in one way it count up well, but when i turn the encoder in the other way (down) I read a count that is is two times more than the count up (count down = 2 * count up) !!!!
    Does someone have meet this problem before?
    Any solution to solve this problem ?
    Thanks.
    dpasssounaud

    Hello,
    Your programmation seems to be OK. And the connections too.
    Please, test the program in the attached file and tell me about the results.
    Sanaa T
    National Instruments
    Attachments:
    Mes_Ang.zip ‏5 KB

  • Measure Angular Position using quadrature encoders

    Hi I’m new to LabView and NI and would like to know whether the angular position, measured using two quadrature encoders can be measured (and interfaced with LabView) using the following National Instruments hardware:
    NI cRIO-9014 (CompactRIO Real-Time Controller)
    NI-9403
    NI-9215
    NI-9263
    If it can be done I would really appreciate some pointers or suggestions of how to start either setting the hardware up or writing the LabView program.
    Many Thanks
    Alex

    Hi Alex
    Welcome to the world of LabVIEW and NI. You're off to a great start with the hardware and software that you already have. It sounds like you just need a bit of extra knowledge to get you started. A great place to look for help is in the LabVIEW  Find Examples.. This can be found on the LabVIEW splash screen pictured in the attached image.
    For your specific set up I would also suggest navigating to the following links:
    NI CompactRIO Starter Kit and Hardware Setup Wizard Frequently Asked Questions (FAQ)
    It may well be an idea for you to attend one of our customer education courses which would really give you a headstart in your application. Information regarding this can be found here:
    LabVIEW Real-Time training
    I hope this information is of some help to get you started.
    Kind regards,
    Daniel T
    Applications Engineer
    National Instruments UK & Ireland
    Attachments:
    Find examples.PNG ‏253 KB

  • Wrong results using the SUM in XPATH- Edit data

    I have a problem when try to do a sum operation using the XPATH function on a set of decimal values:
    To explain it simple, a Service script(also have tried in BPA) which has a edit data step as below
    move '2108.39' to "parm/+listofpay/amt";
    move '1330.8' to "parm/+listofpay/amt";
    move '189.83' to "parm/+listofpay/amt";
    move '4561.12' to "parm/+listofpay/amt";
    move '480.55' to "parm/+listofpay/amt";
    move "sum(parm/listofpay/amt)" to "parm/totamt";
    and the schema is
    <schema>
    <totamt dataType="number"/>
    <listofpay type="list">
    <amt dataType="number"/>
    </listofpay>
    </schema>
    When tried to display(calling through a BPA) the parm/totamt i get a result 8670.68999999999 instead of 8670.69
    Oracle support says it a problem with rounding, how can we have a rounding problem in addition ?
    any suggestions please ?

    Hi Manfred!
    Our setup is very straight forward. We are using a generic M-Series board to generate the stimulus signal as follows:
    Output frequency for x-number of cycles - measure gain/phase response.
    To sample the response, we are using an S-Series board. All of it is done using DAQmx drivers, which again, I don't think makes any difference, since we are experiencing the same problems with a 'pure' software simulation.
    Our unit under test is comprised of a resistor and a capacitor, which represents a simple low pass filter with predictable gain/phase response.
    It appears to us that the erratic phase response at higher frequencies is a result of 1pi versus 2pi phase wrap or flip, which may not be handled correctly by the lock-in tool kit.
    We were thinking of "unwrapping" the phase, but I wanted to find an explanation for this behaviour first, to ensure that we are not dealing with a software bug.
    Also, where can we find the unwrap phase.vi?
    Thanks,
    Markus
    www.movimed.com - Custom Imaging Solutions
    www.movitherm.com - Advanced Thermography Solutions

  • Using PCI-6025E with quadrature encoder.

    Hi,
    i'm presently trying to figure out if i can use the PCI-6025E Card to count up/down with a quadrature encoder with no additionnal hardware. I know my answer lies in a document called "Using Quadrature Encoders with E Series DAQ Boards document " but it is not presently available on the ni website.
    Can any1 either confirm me that i can do this or send me the document?
    Thank you,
    Max

    This link seems to confirm that you can
    Link
    Randall Pursley

  • Quadrature encoder with PCI-6259 DAQ board (driver for QNX)

    where can I find any example for connecting Quadrature Encoders with M Series DAQ Boards ?
    The only more or less suitable example I found in nimseries DDK, is
    "Count pulses from an external source using an external signal to control
    the count direction" (nimseries\Examples\gpctex2.cpp).
    But this example is not working correctly with Quadrature Encoders
    (encoders with  two shifted on 90 degrees phases A&B).
    i.e. in case of using this example code I get some extra count while encoder is on vibrant motor
    what means enums
    typedef enum {
           kG0_Up_DownHardware          = 2,
           kG0_Up_DownHardware_Gate     = 3,
    } tG0_Up_Down;
    and
    typedef enum {
           kG0_Encoder_Counting_ModeId          = 1,
    } tId;
    in (nimseries\ChipObjects\tTIO.h) ?
    What initalization procedure I need to work with Quadrature Encoders?
    I have PCI-6259 DAQ device
    and I'm writing programm under QNX6 operating system

    Hello alexey_3269,
    If you want to read a quadrature encoder start with gpctex1.cpp and follow the thread.
    I give you my code:
    BEGIN CODE
    ==========
    boardGpct->G0_Mode.writeG0_Load_Source_Select(tTIO​::tG0_Mode::kG0_Load_Source_SelectLoad_A);
    boardGpct->G0_Load_A.writeRegister(InitialCount);
    boardGpct->G0_Command.writeG0_Load(1);
    boardGpct->G0_Load_B.writeRegister(0);
    boardGpct->G0_Load_A.writeRegister(0);
    boardGpct->G0_Input_Select.setG0_Source_Select(9); //see above for choices, PFI8=9, 100 kHZ=18
    boardGpct->G0_Input_Select.setG0_Source_Polarity(1​); //0=CCW, 1=CW
    //If using 80 MHz timebase
    boardGpct->G0_MSeries_Counting_Mode.writeG0_MSerie​s_Alternate_Synchronization(1);
    boardGpct->G0_MSeries_Counting_Mode.setG0_MSeries_​Encoder_Counting_Mode(3);  //3 for X4 encoder counting
    boardGpct->G0_MSeries_Counting_Mode.flush();
    //Enable Input Pins
    boardGpct->G0_MSeries_ABZ.setG0_A_Select(9);  //PFI8=9,
    boardGpct->G0_MSeries_ABZ.setG0_B_Select(21); //PFI10=21
    boardGpct->G0_MSeries_ABZ.setG0_Z_Select(10); //PFI9=10 
    boardGpct->G0_MSeries_ABZ.flush();
    boardGpct->G0_Mode.setG0_Gate_Polarity(1); //invert=1
    boardGpct->G0_Mode.setG0_Output_Mode(tTIO::tG0_Mod​e::kG0_Output_ModePulse);
    boardGpct->G0_Mode.setG0_Loading_On_Gate(tTIO::tG0​_Mode::kG0_Loading_On_GateNo_Reload);
    boardGpct->G0_Mode.setG0_Loading_On_TC(tTIO::tG0_M​ode::kG0_Loading_On_TCRollover_On_TC);
    boardGpct->G0_Mode.setG0_Gating_Mode(tTIO::tG0_Mod​e::kG0_Gating_ModeLevel_Gating); //kG0_Gating_ModeGating_Disabled
    boardGpct->G0_Mode.setG0_Gate_On_Both_Edges(tTIO::​tG0_Mode::kG0_Gate_On_Both_EdgesBoth_Edges_Disable​d);
    boardGpct->G0_Mode.setG0_Trigger_Mode_For_Edge_Gat​e(tTIO::tG0_Mode::kG0_Trigger_Mode_For_Edge_GateGa​te_Starts_TC_Stops);
    boardGpct->G0_Mode.setG0_Stop_Mode(tTIO::tG0_Mode:​:kG0_Stop_ModeStop_On_Gate);
    boardGpct->G0_Mode.setG0_Counting_Once(tTIO::tG0_M​ode::kG0_Counting_OnceNo_HW_Disarm);
    boardGpct->G0_Mode.setG0_Reload_Source_Switching(t​TIO::tG0_Mode::kG0_Reload_Source_SwitchingAlternat​e);
    boardGpct->G0_Mode.flush();
    boardGpct->G0_Command.setG0_Up_Down(tTIO::tG0_Comm​and::kG0_Up_DownHardware); //kG0_Up_DownSoftware_Down
    boardGpct->G0_Command.setG0_Bank_Switch_Enable(tTI​O::tG0_Command::kG0_Bank_Switch_EnableBank_X);
    boardGpct->G0_Command.setG0_Bank_Switch_Mode(tTIO:​:tG0_Command::kG0_Bank_Switch_ModeGate);
    boardGpct->G0_Command.flush();
    boardGpct->Interrupt_G0_Enable.setG0_TC_Interrupt_​Enable(0);
    boardGpct->Interrupt_G0_Enable.setG0_Gate_Interrup​t_Enable(0);
    boardGpct->Interrupt_G0_Enable.flush();
    END CODE
    ========
    I hope this code is appropriate to you.
    FV1234

  • I am trying to print a color photo on my MacBook Pro from iPhoto (not using Photoshop) using Epson 2200 printer, and everything I do in the Color Matching and Print Settings results in a photo with a pink cast to it. What am I doing wrong?

    I am trying to print a color photo on my MacBook Pro from iPhoto (not using Photoshop) using Epson 2200 printer, and everything I do in the Color Matching and Print Settings results in a photo with a pink cast to it. What am I doing wrong?

    Have you checked the ink cartridges and made sure the nozzles are clear? Are you able to print from outside of iPhoto with the correct color?
    Try the following: make temporary copy of the library and do the following:
    1 - delete the iPhoto preference file, com.apple.iPhoto.plist, that resides in your
         User/Home()/Library/ Preferences folder.
    2 - delete iPhoto's cache file, Cache.db, that is located in your
         User/Home()/Library/Caches/com.apple.iPhoto folder. 
    3 - launch iPhoto and try again.
    NOTE: If you're moved your library from its default location in your Home/Pictures folder you will have to point iPhoto to its new location when you next open iPhoto by holding down the Option key when launching iPhoto.  You'll also have to reset the iPhoto's various preferences.
    OT

  • Simple query with like return wrong result

    Hi,
    I run simple query with like.
    If I use parameter I get wrong results.
    If I use query without parameter results are ok.
    My script:
    ALTER SESSION SET NLS_SORT=BINARY_CI;
    ALTER SESSION SET NLS_COMP=LINGUISTIC;
    -- drop table abcd;
    create table abcd (col1 varchar2(10));
    INSERT INTO ABCD VALUES ('122222');
    insert into abcd values ('111222');
    SELECT * FROM ABCD WHERE COL1 LIKE :1; -- wrong result with value 12%
    COL1
    122222
    *111222*
    select * from abcd where col1 like '12%'; -- result ok
    COL1
    122222
    I use Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    and query run in Oracle SQL Developer 3.1.07.

    Hi,
    welcome to the forum.
    When you put some code please enclose it between two lines starting with {noformat}{noformat}
    i.e.:
    {noformat}{noformat}
    SELECT ...
    {noformat}{noformat}
    You should specify exactly how you run your code.
    If I run this statement in SQL Plus:SQL> ALTER SESSION SET NLS_SORT=BINARY_CI;
    Session altered.
    SQL> ALTER SESSION SET NLS_COMP=LINGUISTIC;
    Session altered.
    SQL>
    SQL> -- drop table abcd;
    SQL> create table abcd (col1 varchar2(10));
    Table created.
    SQL>
    SQL> INSERT INTO ABCD VALUES ('122222');
    1 row created.
    SQL> insert into abcd values ('111222');
    1 row created.
    SQL>
    SQL> SELECT * FROM ABCD WHERE COL1 LIKE :1;
    SP2-0552: Bind variable "1" not declared.
    SQL>
    I got this error. So I wonder how you set value 12%
    Please specify exactly how you run your test as we cannot reproduce your problem.
    Regards.
    Al                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Using the Convert button in Adobe XI results in a pdf with check boxes containing ? marks

    Using the Convert button in Adobe XI results in a pdf with check boxes containing ? marks@

    Hi Charles,
    Are you still facing this issue. Is this issue reproducible with every file you want to convert.
    Regards,
    Ajlan Huda.

  • I tried updating Itunes to the 10.7 version so I cound use my iphone with it but during the final installation a message pops up about something being wrong with a network resource??!! Need Help Please

    I tried updating Itunes to the 10.7 version so I could use my iphone with itunes, but at the final installation a message apppears saying Itunes can't be downloaded because of a wrong network resource. Please help!!

    Which particular .msi file does the message go on to say cannot be found? (Several different .msi files might be mentioned in this context: itunes.msi, bonjour.msi, AppleSoftwareUpdate.msi, etc.)

  • When using time machine with external hardrive to backup, some music items from iTunes and some photos from iPhoto do not transfer to backup hardrive.  What am I ding wrong?  Using latest version of mountain lion.

    When I use time machine with my external harddrive to back up computer, some music from iTunes library, and some photos from iPhoto library are missing when I check backup disk.  I am using latest version of mountain lion.  Am I doing something wrong?

    First, Time Machine doesn't completely back up the iPhoto library while iPhoto is running. Make sure you quit iPhoto after making any changes to allow a backup to take place.
    This simple procedure will clear your Time Machine settings, including both overt and hidden exclusions. If you have a long exclusion list that can't be recreated easily, you may prefer a more complicated procedure that preserves the exclusion list. In that case, ask for instructions. Otherwise, do as follows.
    Triple-click the line below to select it:
    /Library/Preferences/com.apple.TimeMachine.plist
    Right-click or control-click the highlighted line and select
    Services ▹ Reveal
    from the contextual menu. A Finder window should open with a file selected. Copy it to the Desktop. Then move it (the original, not the copy) to the Trash. You'll be prompted for your administrator password. Reboot, recreate your settings in the Time Machine preference pane, and run a backup to test. If TM now performs as expected, delete the file you copied to the Desktop.

  • Huge latency reading quadrature encoders

    I'm using a PCI-6601 to read two quadrature encoders on a pan-tilt mechanism. The software uses the DAQmx C interface and polls the encoder positions at 200Hz. The problem is that there appears to be a huge latency on the order of ~50msec between when the encoders move and when the positions being read out reflect the movement. That can't be normal.... is it?
    I am able to get data off the DAQ at the 200Hz rate, and the values all look reasonable except that they're time delayed by the aforementioned 50ms. So I'm getting a resolution of at least 5ms, just time-shifted. The first thought was that the values were being buffered somehow, but there doesn't appear to be any buffer, at least that I can find. As I understand it quadrature input shouldn't be being buffered in the first place, and in any case a buffer should be read out with the call to DAQmxReadCounterF64 (the DAQ returns only 1 value), and indeed explicitly setting the input buffer via DAQmxCfgInputBuffer does nothing. 
    To double check the results I tested NI's sample code for reading quadrature encoders (http://zone.ni.com/devzone/cda/epd/p/id/5735) and I get the same latency (minus the ~5ms that was caused by the 200Hz timer, as the sample code polls in a tight loop.)
    Any idea of what might be going on here?
    Thanks!
    Gene

    Hi Gene,
    I just wanted to make sure you were indeed using DAQmx (since you linked the DAQmx Base example).  I might expect the DAQmx Base version of the code to take longer to execute, but re-reading your post it sounds like the problem isn't with the code keeping up but rather that the values themselves are delayed by ~50 ms.
    A buffer would only be allocated if you configure sample clock timing on your encoder task.  The example you linked doesn't do this, so I'll assume your code doesn't either.  It's probably worth noting that you can configure a hardware-timed sample clock so you can deterministically sample the count register at regular intervals, but this isn't going to help with latency.
    So taking a step back for a moment, I am now curious on how you are measuring the 50 ms latency.  To verify a 50 ms delay would require measuring the actual time difference between the start of the counter task and the first pulse of the encoder and then comparing the measured time with the time you are seeing in software (assuming ~5 ms per sample from your 200 Hz polling loop).  I would not expect a 50 ms latency in your measurement, so it's probably worth elaborating on exactly what you are seeing and how you are characterizing it.
    Best Regards,
    John Passiak

  • NOT IN operator giving the wrong results

    DB version:10gR2
    Why is NOT IN giving the wrong results. Isn't NOT EXISTS operator a flawless alternative to NOT IN?
    create table my_table1 (col1 number);
    insert into my_table1 values (1);
    insert into my_table1 values (2);
    commit;
    create table my_table2 ( col1 number);
    insert into my_table2 values (1);
    commit;
    select * from my_Table1;
           COL1
              1
              2
    select * from my_table2;
           COL2
              1
      --correct result
      SELECT * FROM my_table1 t1 WHERE NOT EXISTS
    (SELECT * FROM my_table2 t2 WHERE t1.col1 = t2.col1)
           COL1
              2
    ---correct result using IN
    SELECT * FROM my_table1 t1 where col1 not in (select col1 FROM my_table2 t2);
           COL1
              2
    Inserting a NULL to my_Table2
    Now the query using NOT IN is returning wrong results.
    insert into my_table2 values (null);
    commit;
    SELECT * FROM my_table1 t1 where col1 not in (select col1 FROM my_table2 t2);
    no rows selected
    Query using NOT EXISTS is still giving the right results.
    SELECT * FROM my_table1 t1 WHERE NOT EXISTS
       (SELECT * FROM my_table2 t2 WHERE t1.col1 = t2.col1);
           COL1
              2

    ScottsTiger wrote:
    can i use NOT EXISTS(with a proper Co-related subquery) as a safe alternative to NOT IN?Depends on your data and what you need to achieve.
    Personally I avoid using NOT EXISTS or NOT IN if I can really help it.
    My preferred method is to outer join the tables together and then remove any resultant rows where a value exists and I didn't want one. ;)

  • Problem Using Sax parser with Eclipse 3.0 and command line

    Hi,
    I am parsing a xml file with sax. When I am running my programm in the command line everthing is ok and I get the right results from parsing.
    But if I am running the programm in Eclipse 3.0 (the same java code) I get an other result (the wrong results).
    Does anybody know what this can be the reason for. Is Eclipse using an other xml parser and if where I can change the parser?
    It would be very kind if somebody can give me a reason for this strange behaviour.
    Thanks in advance

    I have solved my problem.
    In the command line I used jre 1.4 and in Eclipse I used jre 1.5.
    I think jre 1.5 uses an other xml parser so I got an other result.
    If i use in Eclipse jre1.4 I get the same result as in the command line.

Maybe you are looking for

  • Error in creating connection to app server  (10.3.4) from JDev 11.1.1.4.0

    Hi Everyone, I am trying to create a application server connection (weblogic server 10.3.4) from JDeveloper 11.1.1.4.0. but when I test the connection, I get status/response as " 0 of 0 tests were successful". Can anyone pls shed some lights on the i

  • How can i insert character data in a table using the report trigger

    well here is my query do_sql ('insert into report_trigger_details values(po report,before parameter)'); i need to to insert data from within the report using the before parameter form trigger.Error is as follows: error: rep-1425,cant parse the statem

  • No Garage Band Loops are installing  SOLVED!!!!

    I just wanted to thank nhmacusr for his very helpful answer to an old question as well as my recent post. I had done multiple installs and was still missing a substantial amount of basic instrument loops. His...or her (?!) recommendation were as foll

  • CDATA output  Cocoon WLS 7.0

    In alot of our xsl stylesheets we wrap xml and javascript within !<CDATA[ xxxx ]]> tags so that it is not parsed. This has worked well for us with the output being delivered successfully. Using the new version of our web server, Weblogic 7.0, this ap

  • Having trouble deleting e mails

    Am having trouble deleting e mails with hourglass showing and nothing happening.