IN operator does not

Hi all

I cannot understand how an operator in works in the following cases

I have 2 tables
TBL
----------------
coltwo (varchar2) colthree (number)
ABCD/PQR 12345
ABCD 13452
PQR 12343
MNO 12334

Tbl_Main
----------------------
m_col1 (Varchar2) m_col2 (Varchar2)
A_B_C_D ABCD/PQR
A1_B1_C1_D1 ABCD/PQR
E_E_E EEE
P_Q_R PQR

Declare
V_var varchar2 (100);
V_Var2 varchar2 (100);
Begin
Select "' | REPLACE (coltwo, "/", "", "') |" ' in V_var from Tbl where colthree = 12345;
Select coltwo in the Tbl V_var2 where colthree = 12345;
dbms_output.put_line (V_var);
dbms_output.put_line (V_var2);

I'm in (select m_col1 IN the Tbl_main WHERE m_col2 IN (V_var) or m_col2 like '%' |) V_Var2 | » %' )
Loop
dbms_output.put_line (i.m_col1);
End loop;

End;


Output of DBMS
-------------------
'ABCD', 'PQR '.
ABCD/PQR
P_Q_R

where as it should be
-------------------
'ABCD', 'PQR '.
ABCD/PQR
A_B_C_D
A1_B1_C1_D1
P_Q_R


Packages above should get all the lines of m_col1 of Tbl_Main that m_col2 such as ABCD, ABCD/PQR or PQR.
but for some reason, I get rows of ABCD/PQR. I don't understand why the in operator does not work.
It is not an error or a warning outside the above question, everything works fine... can you tell me where I'm wrong or why I get no results except

Thanks
Saami

Hi, Sami,

You set v_var to the string of 12 characters:

'ABCD','PQR'

The condition

m_col2 IN (V_var)

is never TRUE with this example data, because m_col2 is never this same string of 12 characters.

In other words, you make the equivalent of

m_col2 IN (Q'['ABCD','PQR']')

When there is a 12 string in the IN list, not the equivalent of

m_col2 IN ( Q'[ABCD]'
          , Q'[PQR]'
          )

where there are 2 strings (one with 4 characters, the other 3 characters) in the IN list.
Try changing:

Select ''''||REPLACE( coltwo,'/', ''',''')||'''' into V_var from Tbl where colthree= 12345 ;

TO

SELECT  '/' || coltwo || '/'
INTO     v_var
FROM     tbl
WHERE     colthree     = 12345;

and also to change the condition

WHERE m_col2 IN (V_var)

TO

WHERE   INSTR ( v_var
           , '/' || m_col2 || '/'
           )         > 0

I hope that answers your question.
If not, post a small example of data (CREATE TABLE and only relevant columns, INSERT statements) for all tables and also post the results desired from these data.
Explain, using specific examples, how you get these results from these data.
Always tell what version of Oracle you are using.

Tags: Database

Similar Questions

  • Interactive report 'IN' operator does not work with commas

    Hello

    I use an interactive report of the APEX and I need to filter a column of values a couple.  I use the IN operator column.  However, one of the channels I'm looking for has a comma in it.  The IR treats this as a delimiter and does not find the value. For example, I want to filter the values:

    Oracle Canada ULC

    Oracle America, Inc..

    The operational unit IN in the IR is equal to 'Oracle Canada ULC, Oracle America, Inc...  He finds only the lines with 'Oracle Canada ULC'.  He seems to think that "Oracle America" is the second value in research and "Inc." is the third and can't find anything for them.

    Is there a way to escape the comma in "Oracle America, Inc." so he treats the entire string as a value to search for?

    Thank you

    Steve

    To in front-end (user) has chosen Actions-> filter-> filter-> line Type

    • In the columns , choose your column (operational unit)
    • Functions/operators choose IN
    • In Filter Expression, type your expression ("Oracle Canada ULC", "Oracle America, Inc.")
  • View Manager 5.1 operations does not not after upgrade

    Hi people,

    I'm in trouble with VMware View 5.1 after reclassification of 5.0 to 5.1, vcenter is version 5.0, composer has been improved from 2.7 to 3.0 and all esxi hosts are in version 5.0 with the latest upgrades.

    Any operation work, recompose pools and desktop computers start and don't give any error, if I cancel a redial for an office, for example, it simply shows 'cancelled' and if a test again it is said that the last task is still in progress and I can not to perform a new task. I need to cancel it because it does not start.

    In the dash, everything is green.

    There is no suggestion?

    Thank you.

    It is a problem of EMC storage.   I never would have guessed that, but I'm glad that you solved.   More important still thanks for the reply comes back with the resolution in case someone else runs into this problem.

  • Backup operation does not progress in the center of the Action.

    Original title: backup Windows 7 issue

    Windows 7 backup worked without interruption and the feature in the details of the center of maintenance/maintenance/Backup does not work, that is to say, manage space. What to do to fix this?

    Hello

    I suggest to create a new user account and then try to create a backup and check if it works.

    Create a user account: http://windows.microsoft.com/en-US/windows7/Create-a-user-account

    If create new allows user account, then he try the steps outlined in the following link to resolve the damaged user account.

    Fix a corrupted user profile:

    http://Windows.Microsoft.com/en-us/Windows7/fix-a-corrupted-user-profile

    Hope the information is useful.

  • AS the operator does not work with the DATE

    Hello
    I have a simple select statement and in the WHERE clause if I use AS with a date field it doesn't but it works with a string field. For example:
    --does not work. does not bring any rows
    Select * From MyTab
    Where  time_period Like '%';
    --works and brings ALL data
    Select * From MyTab
    Where  level_code Like '%';
    Where time_period is of data type DATE and VARCHAR2 level_code.

    Hello

    That's how AS is supposed to work.

    x LIKE y
    

    won't be TRUE if x is ZERO, no matter what.

    If you want an expression which returns TRUE when x is NULL and y '%', then use NVL to map NULL to an appropriate value.
    For example:

    Select  *
    From      Mytab
    Where       NVL ( TO_CHAR ( time_period
                          , 'MM/DD/YYYY HH:MI:SS AM'
                    )
             , ' '     -- One space
             ) Like '%';
    

    TO_CHAR to explicitly create a string based on a DATE, in the format that you want. Do not rely on implicit conversions.

  • Remove operation does not work

    Hello

    JDev 11.1.2.4

    Once more a strange ADF issue. I select a row in a table (founded iterator VO/OS), and click a button that invokes an action binding method remove which was created by selecting the iterator, then the Delete operation. When you click this button, I can see that in the newspaper:

    < DCUtil > < findSpelObject > [7016] DCUtil, returning:oracle.jbo.uicli.binding.JUApplication, for IRRISAppModuleDataControl

    ViewRowCache < ViewRowCache > < removeReference > [7017]: removeReference, id = 782 RV

    < JUCtrlHierNodeBinding > < raiseRowDeleted > [7018] liaison: noCtrl_oracle_adfinternal_view_faces_model_binding_FacesCtrlHierNodeBinding_314, DataChangeEvent REMOVE arises.

    < ADFLogger > < start > list get LOV

    < DCUtil > < findSpelObject > [7019] DCUtil, returning:oracle.jbo.uicli.binding.JUApplication, for IRRISAppModuleDataControl

    List of < ADFLogger > < addContextData > get LOV

    List of < ADFLogger > < end > get LOV

    Then I updated my iterator and my table component, but the line is not deleted. So to eliminate the fact it might be a problem of refreshment, I click on a button that COMMIT. I don't have the SQL DELETE statement.

    I tested the OV AM Tester and I can remove and commit this deletion.

    Any idea?

    Thank you

    After some tests, I discovered that the selected line has not changed during the selection of a row, I change the selection of single votes to zero, then returns to the single. Now it's working.

  • SYSDBA operations does not contain the connection during the audit id information

    Server: AIX

    database: 11.2.0.3.0

    audit_sys_operations is set to true. It's follow the operations performed by users of sys.


    do you have a test like case below and was not able to find the username of the BONE

    Connect to the server with my ID (example thinkdba)

    sudo su - oracle.


    now connected to the database as "/ as sysdba" and performed some operations

    and perform

    Drop user test cascade;


    But aud files was not my credentials no matter where (as I do not found my login id in the aud files.)


    LENGTH: "176"

    "ACTION: ['22] drop user test cascade.

    USER DATABASE: [1] ' / '.

    PRIVILEGE: "SYSDBA" [6]

    CLIENT USER: [6] "oracle"

    How can I capture my login id if I connect as sysdba?

    Concerning

    Thinkdba

    Think_dba wrote:

    In my environment, we have many dba work by typing sudo su - oracle after they connected with their login id

    Example:

    If I can connect with my id say thinkdba

    and then I do sudo su - oracle

    I want results as below:

    «"CLIENT USER: [6] thinkdba»»

    I want to win the lottery.

    You can't always get what you want.

    the database knows only that reports OS & OS 'oracle' user has registered in the DB.

  • Delete operation does not remove the newly created line of VO

    Hi all

    I use Jdev 11.1.1.7

    I try to use a simple delete on a line of an af:table operation.

    The line is newly created (not in DB) and I have some autoSubmit = "true" defined on certain inputText of the table (not sure if it's relevant information).

    I followed the nice post of Andrejus on the immediate = "true" the button Delete.

    Andrejus Baranovskis Blog: Deleting line new form ADF (ADF followed Webinar)

    It works fine when I delete the line, it ignores validation and disappears from my af:table.

    But when I commit my transaction, all new lines, even those deleted, stored in DB.

    No idea what could be the problem?

    Let me know if you need me to post the code.

    Thanks for your time!

    I found the problem in the definition of my VO.

    The use of the entity has been defined with the property DeleteParticipant = "false"...

    What I don't understand is the reason why I had to go to the source to change, in the overview of the VO, the box is read-only...

  • As the operator does not

    Hi have a backlog of table where I have a column called item_number

    I reported on this table, and I have included all the item_number. Now I have to create another set of reports where I need to exclude records based on the item_number.

    For this, I did a static lov that has values such as SERVICE, SAMPLE, EBV

    The item_number is db contains SERVICE, SAMPLE, EBV in them. Include

    SERVICE WFR SEN
    SERVICE NRE SEN
    SAMPLE NRE SEN
    SAMPLE WFR SEN
    EBV NRE SEN
    EBV WFR SEN


    In my report, I use the like as operator
    and a.item_number like '%:P2_ITEM_NUMBER%'
    [/CODE]
    
    I have used the :P2_ITEM_NUMBER because i have a select list in the report page.
    
    Apart of it i want one more query to exclude the selected value of :P2_ITEM_NUMBER from report
    
    
    Thanks in advance
    
    Regards                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        

    Well Yes.

    In regards to the msd column, not you would get no problem as such, but the way you have don it is a bad habit and would negate any clue on msd unless you had an index of based function on (that would be useless in the case of theis) - the alternative that I was would be a clue to the msd can be used.

    See you soon

    Ben

  • Why my IN operator does not change the data type

    Hello

    This makes no sense, but I hope that there is an obvious answer that you have seen a million times before.

    I have this criterion in my WHERE clause
     AND rpg_id = (SELECT rpg_id
                                             FROM integration.rep_elig_groups
                                            WHERE pel_id IN(34))
    because of this clause, no results are returned in my query. However if I use a function like this to_number:
     AND rpg_id = to_number(SELECT rpg_id
                                             FROM integration.rep_elig_groups
                                            WHERE pel_id IN(34))
    OR
     AND to_char(rpg_id) = (SELECT rpg_id
                                             FROM integration.rep_elig_groups
                                            WHERE pel_id IN(34))
    I get the results returned expected.

    The application of void: -.
    SELECT rpg_id
                                             FROM integration.rep_elig_groups
                                            WHERE pel_id IN(34)
    Returns the value of 226. rpg_id in this table is a NUMBER data type. As it is rpg_id in the original outer query.

    I looked at synonyms, views, and other objects, it could use for rep_elig_groups table, but there is not.

    Then I tried to change the IN operator to an EQUALS operator and believe you, it worked.
    AND rpg_id = (SELECT rpg_id
                                             FROM integration.rep_elig_groups
                                            WHERE pel_id IN(34))
    Please can someone explain what ORACLE think here!

    Thank you very much

    Published by: tri_harder on December 9, 2008 16:48 missed the hook closing in the final piece of code!

    Published by: tri_harder on December 10, 2008 08:44

    tri_harder wrote:
    I use Oracle Database 10 g Enterprise Edition Release 10.2.0.2.0. I have no idea if I'll be able to change the STAR_TRANSFORMATION_ENABLED setting, I would need a very good reason to do so, I'm going to find. But why the transformation returns no results?

    There are various bugs related to the star transformation, in particular during the transformation of the temporary table is involved. For example see Metalink Note 47358.1

    You can change the setting STAR_TRANSFORMATION_ENABLED using ALTER SESSION.

    You can use the following trick (undocumented) to set Optimizer settings only for a given statement:

    select /*+ opt_param('star_transformation_enabled', 'temp_disable') */ ...
    

    With regard to the execution plans: check the output of DBMS_XPLAN. DISPLAY. If it shows a down note ' Note: Plan table is old version "then drop all existing tables plan. Since you're using 10.2 it already provides a 'global' PLAN_TABLE (actually a synonym for the global temporary table SYS. Plan_table$) If you do not have the need for a private usually longer.

    Kind regards
    Randolf

    Oracle related blog stuff:
    http://Oracle-Randolf.blogspot.com/

    SQLTools ++ for Oracle (Open source Oracle GUI for Windows):
    http://www.sqltools-plusplus.org:7676 /.
    http://sourceforge.NET/projects/SQLT-pp/

  • Two monitors operations does not not on HP Envy H8

    I have a similar (or perhaps the same) problem with two screens on a HP Envy H8 1437 with Win 8 capacities (64) installed on this system, however; I try to use two DVI ports on the system. I use two HP W2371b monitors. I can't really tell what is the DVI - D or DVI-way, it is not specified in any of the documents I've seen.  I know test inter DVI port works with both/either of my monitors, but external (to be closer on the side of the system) DVI port won't work for a monitor (using the duplicate parameters or extended). Since I use the DVI-VGA adapters for two monitors, I also noticed that the external port DVI will not accept DVI inter port adapter (that works). It seems to need a different type DVI adapter (and I bought and tried at least four different VGA DVI adapters without success). I wonder if there is a parameter or a switch that must be activated or if just, it doesn't work on this desire and I need to buy a dual video card.

    No advice and no useful information would be greatly appreciated.

    Thank you

    Doc

    Assuming that you have a desktop HP ENVY h8-1437 cor embedded integrated DVI ports will work unless you removed the card graphics NVIDIA GeForce GT 620 computer factory installed. If you have removed the card of graph GT 620 discrete, two DVI ports are listed as follows;

    5 - DVI - I (TOP - digital and analog) and DVI - D (LOW - digital only)

    There is no way to passively "adapt" a digital to work on an analog monitor signal. As your W2371d HP 23 inch diagonal LED backlit monitors support the VGA and DVI - D, you must eliminate all the adapters in your configuration and connect the monitor directly to the computer via the supplied DVI - D cable. Please connect your monitor to the computer as follows:

    Computer-> DVI - D cable (using a DVI port)-> monitor #1

    Computer-> DVI - D cable (using other DVI port)-> Monitor #2

    If you have any other questions, feel free to ask.

    Please click the 'Thumbs Up' white LAURELS to show your appreciation

  • VISA series operation does not work when the PC software performs

    Hello everyone.

    I'm using LabVIEW to communicate with a control via VISA series. I can communicate with this box in most areas very well, as surveillance data function I use without any problem. The only thing I have a problem with the unit is calibrated. Calibration is achieved by opening a binary file and transfer the data of 16 bytes at a time during the series with the help of a 16-byte write the command that has this structure: [command, in this case 'P'] [2 bytes from 3800 HEX address] [16 bytes of data] [checksum 1 byte]. I'm correctly calculate the checksum, and the documentation says that the box must respond to all orders less than 100 milliseconds.

    When I try to do, the zone responds with one E several times (E is supposed to say checksum error, even if I am calculating correctly), then no longer responds to nothing. The strange thing is that this box comes with a software that allows to calibrate it and that the software has no problem with him!

    I tried using SuperMon to capture what the software sends on the series and compare it to what I pass, and from what I see, it sends the same data that I do, only he works and mine is not. I also tried using SuperMon to manually send the writing 16 bytes of a calibration function at a time, and he seems to have the same problem.

    It seems that their software works, I do something wrong. Here is a screenshot of my code that I am using. Any help would be greatly appreciated!

    I contacted officials of the control box and have solved the problem. Control box delay needs 5 to 10 milliseconds between each byte, not all orders than I had initially thought. Thanks for all the useful answers, and especially the number of split tip, which really cleans my code!

  • Mouse / touchpad operation does not

    original title: Mouse / touchpad problems

    When you use my mouse or my touchpad on HP laptop any attempt to right click sends the application of windows Explorer mode "not responding".  I find more frequently when highlighting a photo or a file and want to do a right click to copy or cut the option but must close the application to try new unsucessfully.  Have updated the driver with no improvement.  It is uncertain whether I have hardware or software issue.

    Suggestion only:

    Run a file system check. See if damaged screenshots and files and repair them if possible.

    Start button > Search box type cmd > look up, do a RIGHT click oncmd.exe > click onRun As Administrator > in this window cmd black and white, type at the prompt flashingsfc/scannow > press the ENTER key.
    Note: there is a space between 'sfc' and ' / '.
    To sit and wait. It will take time.
    When finished, exit the cmd window.
    Reboot (restart your computer)

    check the Mouse / touchpad thereafter.

    For the benefits of others looking for answers, please mark as answer suggestion if it solves your problem.

  • Merger application, MYSQL DB-Viewcriteria 'Contains' operator does not work

    Hello

    I created Viewcriteria using "Contains" operator in the View object. Because of the symbol of the concatenation of the viewcriteria search form always displaying the message "no data to display.

    How can I use "contains"?

    Thanks in advance.

    Jdev version: 11.1.2.4.0

    DB: MYSQL

    Thank you

    Kalpana.

    How can I use "contains"?


    Refer

    https://tompeez.WordPress.com/2011/08/21/extending-viewcriteria-to-use-SQL-contains-4/

  • MCV move operation does not progress


    Hello

    I have only one Mirage server running without fault for a few months now. I have a volume of 6 TB on a NetApp connected via iSCSI and there less than 300 GB of free space.

    The company I work for has recently got a new NetApp and I'm assigned me a new volume of 8 TB for the Mirage server, the volume is mounted and I have 1 new machine that was centralized in this volume and everything works fine, it seems. The new volume is configured exatly the same way than the current one, same permissions and everything.

    So I wanted to start moving current to the new volume CVDs, I started with 1 CVD to test the process but it seems to be stuck at 60% for more than an hour and I randomly see warnings in the event log for various cardiovascular diseases that the volume is temporarily not available (even if it is still mounted).

    Can anyone say about this? How to troubleshoot or what could cause this?

    Thanks in advance,

    ORI Gil.

    Hi Robert, thanks for the response, but this was not the case

    We want to pass all CVD 300 that we need the new volume and then delete the old volume completely without stopping the service at all.

    The CVD move was stuck at 60% for more than 4 hours, so I stopped it. Finally, our storage guys changed the new storage port to work with 10 GB instead of 1 GB, then I tried to move back the CVD and it seems to have done the trick! The move took about 4 hours in total.

    ORI.

Maybe you are looking for

  • Microsoft Update problems

    Computer says it is downloading updates when stopping down but it seems to be failing on most updates and I get an error code 80070663 when he check.  Any help would be greatly appreciated.  I am running Windows 7 family Premium and trend of security

  • Why I can't complete the registration of CS3 on a new computer?

    I used CS3 for many years now on Mac Book Pro. As I bought a new iMac, I want to use CS3 on it. I downloaded it Download Adobe Creative Suite 3 products cause I didn't have a CD. The key worked but did not activate. I was able to use 30 days trial wh

  • Too small UI and interface scaling user does not seem to do anything

    I have a monitor 27 "with the resolution 1920 x 1080 the value which the scale 100% on Windows 10 OS level value. The user of InDesign interface is very low, to the point where I can barely read the text without leaning in. Illustrator and Photoshop

  • Windows 8: problem with NIC (marvell yukon 88e8042 pci - e fast ethernet)

    Product name: HP6730s OS: Windows8 Error: Unidentified network When I connect to the internet via an adsl modem, occurs an error and can not network identified, when I disable and enable the wired ethernet card once again, it works well

  • Problem installing tools: host Ubuntu 13.04 invited Windows 8

    HelloHost: Ubuntu 13.04 64bitsClient: Windows 8 pro 32 bituname-a:Learningpc 3.8.0 - 19-generic #30 - Ubuntu Linux SMP Wed May 1 16:35:23 UTC 2013 x86_64 x86_64 x86_64 GNU/LinuxVMware Player: 5.0.2 64bitsAfter you install this Windows guest I am appl