How to use LIKE , IN, NULL combined to remove OR operator.

I have a query to get result but we can not use OR operator here. I am trying to find if I can use IN operator somehow to get rid of OR.
Query - Select * from table where col1 like ('%ABC%') or col1 is null;
I am trying to find some query like - Select * from table where col1 IN ('%ABC%', null);
I tried even following but didnt work - Select * from table where col1 IN ('ABC', '');
I just want to remove OR operator from query. Thanks in advance.

user11032875 wrote:
I have a query to get result but we can not use OR operator here. I am trying to find if I can use IN operator somehow to get rid of OR.
Query - Select * from table where col1 like ('%ABC%') or col1 is null;
I am trying to find some query like - Select * from table where col1 IN ('%ABC%', null);
I tried even following but didnt work - Select * from table where col1 IN ('ABC', '');
I just want to remove OR operator from query. Thanks in advance.Select * from table where col1 like ('%ABC%');
union
Select * from table where col1 is null;

Similar Messages

  • How to use LIKE operator in plsql

    Hi
    I wanted to select certain rows using like operator in plsql(Input should be given by the user). I have given my experiment here .I couldn't get any result.
    As per sql syntax while using LIKE operator we should give search criteria within single quote.where as in plsql if we give within single quote its takes as string so no output is comming.what is solution ? How to use like operator in plsql?
    sql syntax
    SQL>SELECT customer_name FROM customer_header
    WHERE customer_name LIKE 'B%' ; customer_name
    Bala murali
    Babu
    Basker
    plsql syntax
    PROCEDURE pro_custheader_like ( v_cname IN varchar2
         ,answer OUT type_refcur_customer) IS
         BEGIN
         OPEN answer FOR
         SELECT customer_name FROM customer_header
              WHERE customer_name LIKE ( ' v_cname ' );
    END pro_custheader_like;
    execution command
    sql>variable answer refcursor;
    sql>set serveroutput on
    sql>exec package_name.pro_custheader_like( 'R',:answer);
    plsql successfully completed
    sql>print :answer
    no row selected
    by
    balamuralikrishnan.s

    plsql syntax
    PROCEDURE pro_custheader_like ( v_cname IN
    varchar2
    ,answer OUT
    type_refcur_customer) IS
    N
         OPEN answer FOR
         SELECT customer_name FROM customer_header
    WHERE customer_name LIKE ( v_cname );
    END pro_custheader_like;
    Try it without any quotes. And, let us know your feedback.
    Regards.
    Satyaki De.
    Message was edited by:
    Satyaki_De

  • How tio use like operator in textitem to get the name

    Oracle forms6i
    Hai All
    I have created an form to create an hierarchy list. I that I had an Text_item how can i use like operator to get the name to select. which trigger i need to use. when i select the name i need to get his employee code and other details
    Thanks In Advance
    Srikkanth.M

    A is the head of Dept 10 and three person are under A namelyHow will you know that B, C and D are under A is there any parent child relationship between Leader and Employee code? If yes, Then you can create the relationship between blocks no need to set where_clause programatically. So, relationship can be like...
    leader_block.emp_code = emp_block.leader_code
    AND leader_blokc.dep_code = emp_block.dep_codeSo, when you will query data in LEADER block it will show employees which are under LEADER which you queried in LEADER block.
    Or if there is no relationship then how will you know that which employee under which leader?
    b 002 10 1
    c 003 10 1
    d 004 10 1
    When i enter the name of head corresponding other members in the department will need to display in the
    Tabular format Or if you want to query the records only for department relation. Then as you said you create two blocks then create create the relationship using dep_code between those blocks.
    like...
    leader.dep_code = emp_block.dep_code-Ammad

  • How to use like operator in loop

    Hi I am trying to use like operation in loop condition. the code is as follows:
    loop at lt_mara into l_mara where l_mara like '%XXX'.
    endloop
    when i have the like operator like above its giving me an error that i cannot use like operator. Is there anyway that i can use like operation in loop at condition,
    Thanks in advance

    using the ranges with CP option we can do that..
    Populate the ranges mentioned below..
    data: r_matnr type range of matnr,
            w_matnr like line of r_matnr.
    w_matnr-low = '%XXX'.
    w_matnr-sign = 'I'.
    w_matnr-option = 'CP'.
    append w_matnr to r_matnr.
    loop at lt_mara into l_mara where matnr in r_matnr.
    endloop
    Regards
    Vijay Babu Dudla

  • How to use the same BSA with more than an operating unit ?

    we have three operating units, sometimes a sales agreement is released from the three operating units, is there a way i can use the same sales agreemnet with the three operating units?

    We had the same issue recently.
    Users wanted same locator in the same org under different subinventories.
    We suggested 2 solutions
    1) Make the 1st locator segment=subinventory name (e.g. East.A.3.10, West.A.3.10)
    2) Add a character to the first locator (e.g. EA.3.10, WA.3.10)
    They picked up the 2nd option.
    Hope this helps
    Sandeep Gandhi
    Omkar Technologies Inc.
    Independent Techno-functional Consultant
    513-325-9026

  • How to use "like" with variables at right hand side ?.Urgent Pls..

    How can I compare a column with a combination of columns.
    columns are character
    select ...from table1 t1,table2 t2 where
    t1.col1 like t2.col1 || t2.col2
    eg:
    where p.upc = '0' ||r.upc_ccode||r.upc_mnum|| r.upc_mcode
    this restricts LHS to start with 0 and values starting with non zero are not taken for comparison.I need to include those values also in comparison
    p.upc can start with any char 0 -9.
    p.upc ->char(12)
    r.upc_commod_code||r.upc_mfg_num|| r.upc_mfg_it -> total char(11)
    Any Help would be highly appreciated !
    Thanks In Advance!

    Hi ,
    There is a simple solution to your problem....Its name is Regular Expressions.
    Read the docs found in links:
    http://www.oracle.com/technology/pub/articles/saternos_regexp.html
    http://download-uk.oracle.com/docs/cd/B19306_01/appdev.102/b14251/adfns_regexp.htm
    http://www.oracle.com/technology/oramag/oracle/03-sep/o53sql.html
    NOTE: You have to use Oracle10g version!!!!!
    Regards,
    Simon

  • How to use LIKE function with a parameter in Oracle REPORT builder??

    how could i use parameter inside a LIKE function in Oracle reports builder?
    it works in SQL plus, but not in report builder!!
    Example:
    select code,desc from item_master where desc
    like '%&give_desc%'; ---works in SQL
    like '%:give_desc%' ---doesn't work in report builder!!

    Hi Renil,
    You will need to use the wildcard character (%) and the concatenation character (||) to join to your user parameter.
    i.e. like '%'||:give_desc||'%'
    Regards,
    John

  • How to use AND and OR Combinations for a Rule in Rule Modeler of ERMS

    Hi Experts,
    When we are defining rules in the Rule Policy, we need to create a condition which uses a combinations of AND and OR.
    But the standard Rule Modeler of ERMS is allowing us to create conditions either using all AND or with all OR options.
    Is there anyway that we can define rules in the Rule Modeler using both AND and OR combinations at the same time.
    Regards,
    NIloufer

    A variant is a very specific LabVIEW datatype (really a C++ type object internally) and trying to pass that to a function, which excepts a flat memory pointer there, for sure will crash very quickly.
    As to endianess, yes Unflatten will be able to adjust for endianess, which in this case however is most likely exectly NOT what you want. So make sure that the you select native type for the endianess input on Unflatten from String. LabVIEW internally works with whatever is the native endianess, as will most likely your C++ DLL. The platform independent big endian format does only come into play when you receive data streams over some streaming interface like a network connection. Here it is desirable to use an endian format that is independent from the actual platform that generates and consumes the data stream. LabVIEWs default endianes is big endian here.
    But as long as you pass data directly to native components like DLLs there is no difference in endianess between what LabVIEW uses and what those components use.
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • How to use LIKE in this CASE?

    There are multiple values that start with "Aerospace".  All of them are going to be set to the same value.  I'm trying to write a Case Statement that will replace all of them with the new value, but i can't get the LIKE to work correctly.
      This can probably be done with REPLACE, but It's bugging me that I can't get the LIKE to work.  
    I've tried a few variations, but compiler hasn't like any of them.  I'm hoping to have one line of code that will work for all of the possible choices.
    What is the best way to use a LIKE or similar thing (such as CONTAINS) to set all of the fields with "Aerospace" at the beginning?
    Sorry for the small font above.  I didn't see how to change it.
    'New Sector Focus' = CASE sectorfocus
    WHEN sectorfocus LIKE 'Aerospace%' THEN '201010 - Aerospace & Defense'
    ELSE sectorfocus
    END

    CASE expression looks good. CASE blog: 
    http://www.sqlusa.com/bestpractices/training/scripts/casefunction/
    >Sorry for the small font above.  I didn't see how to change it.
    Use the HTML icon to edit the html code.
    Kalman Toth Database & OLAP Architect
    SQL Server 2014 Design & Programming
    New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012

  • How to use LIKE keyword in a select statement

    Hi:
    I want to use the following sql statement,
    String str = "xyz";
    String query="Select * from tab where col like '"+str+"' '%' ";
    Kindly suggest
    TIA

    % is a wildcard in the like clause, so:.
    String str = "xyz";
    String query="Select * from tab where col like '%"+str+"%'";

  • How to use like operator in IFTHENELSE (BODS)

    Hi All,
    I want to find the value of  ' % ASSOC%' in the name and replace it to 'Assoc.' using ifthenelse.
    Can any one help me. Is there any similar fuction as LIKE operator. Can we give LIKE in ifthen else condition.
    Thanks in advance

    Hi ,
    if you have data ASSOC1,ASSOC2
    and you want Output like Assoc.1,Assoc.2.
    In this condition it is not possible with ifthenelse function
    it will return output as Assoc.
    Example Source:
    If we use if then else condition. Then it will replace all the Data to Assoc. 
    Or else if you want to replace ASSOC to Assoc. Then you can use Search_Replace also
    it will generate a XML script
    The expected output as follows in the below screen. As per your requirement you can you any one of this.
    Regards,
    Akhileshkiran.

  • How to use LIKE operator with PreparedStatement

    Hi, I need to execute a query with the LIKE operator, but using a PreparedStatement. Can I do this, and if so what must my SQL look like with the wildcard characters '%' or '_'?
    normal PS example: conn.prepareStatement("select * from mytable where name like ?");
    If I try: conn.prepareStatement("select * from mytable where name like ?%");
    I get: ORA-00911: invalid character
    If I try: conn.prepareStatement("select * from mytable where name like '?%'");
    I get: ORA-01006: bind variable does not exist
    I must use a PreparedStatement, as my variable may contain illegal characters (like '), and using PreparedStatement.setString(1, var) will automatically escape it for me.
    I could also use a normal Statement, but I need to escape my var ... is there a utility that will safely escape a String for an Oracle VARCHAR2??
    Thanks in advance,
    Stu Miller

    Hmm, it seems you are right...
    when my variable contains a '%' symbol, the PreparedStatement will NOT escape it, and thus it is treated like a wildcard. Therefore, I can just do
    pstmt.setString(1, var+"%");
    But, that may return more results than I'm asking for, as when 'var' contains a '%' symbol it is taken as a wildcard too.
    I need each character in my variable to be taken literally, and only add a wildcard at the end. Basically, I need a STARTSWITH operator ;-)
    It seems to me that escaping the sensitive characters in a String (which will differ depending on which operator is used), should be possible. I could write this, but I was hoping Oracle had already done it for me in some utility class.

  • How To: Use Like '*' with DoQuery

    As anyone who has tried to use a LIKE in their SELECT statement will know, if you are using the DoQuery method of the SAPbobsCOM.Recordset object, LIKE's are not supported.  Here is a workaround that seems to work fairly well for our needs.
    Code Sample:
    findValueLength = findValue.Length.ToString();
    sqlQuery = "SELECT CardName AS ReturnValue1 FROM OCRD WHERE LEFT(CardCode," + findValueLength + ") = '" + findValue + "' AND CardType <> 'S'";
    rs = (SAPbobsCOM.Recordset) sapConnect.SboCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
    rs.DoQuery(sqlQuery);
    Basically, if you select anything who's left x characters are the same as the find value, it will return the same results as doing a LIKE findValue*.
    Message was edited by: David Wall

    Thank you for sharing your solution, David.
    Lutz Morrien

  • How to use LIKE for more than one condition

    I want to get list of usernames starting with A,B, and C....can any one provide the query using LIKE

    You would need to use something more like one of these:
    SELECT username FROM table
    WHERE username LIKE ('AB%') or
          username LIKE ('AC%') or
          username LIKE ('AD%');
    SELECT username FROM table
    WHERE SUBSTR(username, 1, 2) IN ('AB', 'AC', 'AD')
    SELECT username FROM table
    WHERE REGEXP_LIKE (username, '^AB|^AC|^AD')The regexp_like version is only available on 10g or higher.
    John

  • How to use different essbase member combinations in columns in obiee

    Hello,
    I am trying to build a report in obiee which has an essbase ASO cube in the background. We have a measure 'A' that exists in BegBalance and a measure 'B' that exists in months Jan through Dec. So in my criteria, i set the dimensions i need along with "Periods - Default" and in the selection pane set the condition to keep only the months and begbalance. I also set the pivot so that the periods and the measures show up in columns.
    When i run the report, in the columns for both measures, i get begbalance and the 12 months.
    However, i only want measure A to show with begbalance and measure B to show with the 12 months. How can i accomplish this?]
    Any help will be much appreciated.
    Thanks.

    Hi,
    Yeah, that is there. I have not copied that code in my post...
    try {
                dataTable1Model.setObject(1,this.getSessionBean1().getTeamName());
                dataTable1Model.setObject(2, this.getSessionBean1().getFis_Year());
                dataTable1Model.execute();
            } catch (Exception x) {
                teamRowSet.close();Thanks

Maybe you are looking for

  • Release Rules Problem

    Hi All, While Settin Up the OM,there existing a problem in Release Rules:- in tab Inventory in (Define Release rules form) when i go to select the warehouse ,i can not find any organizations defined . it appears empty. thanks.

  • Status bar turned red

    While I was using my iPad, the status bar at the top (the black bar all the way at the top with the clock) suddenly turned red for a very brief moment.  Out of the corner of my eye, I saw some words there.  But when I shifted my focus to read what wa

  • Image Gallery in Safari

    Hi, modified the demo image-gallery and finally got it working for me properly in IE and Firefox. But finally my whole dataset comes with undefined values in Safari. The gallery is here and here's the xml. Could anyeno be so kind and have a quick loo

  • Message sent from RWB but not reflected in SXMB_MONI

    Hello Experts, I have a SOAP - RFC synchronous scenario. I am sending a message from RWB to PI system.It shows message sent in RWB and the message details are reflected in the RWB->message monitoring ->Adapter Engine as 'Successfull'. But no in RWB->

  • I bought a pre-payment cards and we could not filling

    Dear Sir / Madam Good Day I bought a pre-payment cards and we could not filling. Best regards Hussain Aviation