In 4.6c, use IN operator in IF statement when we are having few values

I am trying to use IN operator inspite of IF with OR operator. But the IN opereator is not working with the value, please suggest me how to improve this code
IF v_zuonr(3) EQ 500
OR v_zuonr(3) EQ 551
OR v_zuonr(3) EQ 562
OR v_zuonr(3) EQ 593
OR v_zuonr(3) EQ 594
OR v_zuonr(3) EQ 605.
v_final = v_sgtxt.
ELSE.
v_1 = v_sgtxt(6).
v_2 = v_sgtxt+6(24).
CONCATENATE v_1 v_2 INTO v_final SEPARATED BY space.
ENDIF.

Hi,
It is better to use IF with OR condition, otherwise you need to write more no of lines code that IF with OR.
Please have a look into the below code:
DATA : v_zuonr TYPE char3 VALUE '605',
       v_1      TYPE char30,
       v_2      TYPE char30,
       v_final  TYPE char30,
       v_sgtxt TYPE char30 VALUE '1234567891011121314'.
DATA : t_option TYPE RANGE OF char3,
       wa_option LIKE LINE OF  t_option.
wa_option-sign = 'I'.
wa_option-option = 'EQ'.
wa_option-low = '500'.
wa_option-high = ' '.
APPEND wa_option TO t_option.
CLEAR wa_option.
wa_option-sign = 'I'.
wa_option-option = 'EQ'.
wa_option-low = '551'.
wa_option-high = ' '.
APPEND wa_option TO t_option.
CLEAR wa_option.
wa_option-sign = 'I'.
wa_option-option = 'EQ'.
wa_option-low = '562'.
wa_option-high = ' '.
APPEND wa_option TO t_option.
CLEAR wa_option.
wa_option-sign = 'I'.
wa_option-option = 'EQ'.
wa_option-low = '593'.
wa_option-high = ' '.
APPEND wa_option TO t_option.
CLEAR wa_option.
wa_option-sign = 'I'.
wa_option-option = 'EQ'.
wa_option-low = '594'.
wa_option-high = ' '.
APPEND wa_option TO t_option.
CLEAR wa_option.
wa_option-sign = 'I'.
wa_option-option = 'EQ'.
wa_option-low = '605'.
wa_option-high = ' '.
APPEND wa_option TO t_option.
CLEAR wa_option.
IF v_zuonr(3) IN t_option.
  v_final = v_sgtxt.
ENDIF.
IF v_zuonr(3) EQ 500
OR v_zuonr(3) EQ 551
OR v_zuonr(3) EQ 562
OR v_zuonr(3) EQ 593
OR v_zuonr(3) EQ 594
OR v_zuonr(3) EQ 605.
  v_final = v_sgtxt.
ELSE.
  v_1 = v_sgtxt(6).
  v_2 = v_sgtxt+6(24).
  CONCATENATE v_1 v_2 INTO v_final SEPARATED BY space.
ENDIF.
Shiva

Similar Messages

  • Joining 2 related records using PL SQL in Apex - Problems when there are more than 2 related records?

    Hi
    I am combining 2 related records of legacy data together that make up a marriage record.  I am doing this in APEX using a before header process using the following code below which works well when there are only 2 related records which joins the bride and groom record together on screen in apex.  I have appended a field called principle which is set to 'Y' for the groom and 'N' for the bride to this legacy data
    However there are lots of records where in some instances there are 3, 4 , 5, 6 or even 1 record which causes the PL/SQL in APEX to not return the correct data.  The difference in these related columns is that the name of the bride or groom could be different but it is the same person, its just that from the old system if a person had another name or was formally known as they would create another duplicate record for the marriage with the different name, but the book and entry number is the same as this is unique for each couple who get married.
    How can I adapt the script below so that if there are more than 2 records that match the entry and book values then it will display a message or is there a better possible work around?  Cleaning the data would be not an option as there are thousands of rows of where these occurrences occur
    declare 
         cursor c_mar_principle(b_entry in number, b_book in varchar2) 
         is 
              select DISTINCT  id, forename, surname, marriagedate, entry, book,  formername, principle
              from   MARRIAGES mar 
              where  mar.entry   = b_entry
              and    mar.book = b_book
              order by principle desc, id asc; 
         rec c_mar_principle%rowtype;
    begin 
    open c_mar_principle(:p16_entry,:p16_book)  ;
    fetch c_mar_principle into rec;
    :P16_SURNAME_GROOM   := rec.surname; 
    :P16_FORNAME_GROOM   := rec.forename;
                   :P16_ENTRY := rec.entry; 
                   :P16_BOOK :=rec.book;
    :P16_FORMERNAME :=rec.formername;
    :P16_MARRIAGEDATE :=rec.marriagedate;
    :P16_GROOMID  := rec.id;
    fetch c_mar_principle into rec;
    :P16_SURNAME_BRIDE   := rec.surname; 
    :P16_FORNAME_BRIDE   := rec.forename;
                   :P16_ENTRY := rec.entry; 
                   :P16_BOOK :=rec.book;
    :P16_FORMERNAME :=rec.formername;
    :P16_MARRIAGEDATE :=rec.marriagedate;
    :P16_BRIDEID  := rec.id;
    close c_mar_principle;
    end;

    rambo81 wrote:
    True but that answer is not really helping this situation either?
    It's indisputably true, which is more than can be said for the results of querying this data.
    The data is from an old legacy flat file database that has been exported into a relational database.
    It should have been normalized at the time it was imported.
    Without having to redesign the data model what options do I have in changing the PL/SQL to cater for multiple occurances
    In my professional opinion, none. The actual problem is the data model, so that's what should be changed.

  • Using like Operator in Prepeared Statement

    PreparedStatement s2=dbcon.prepareStatement("Select phone,dnc_message from gsw_donotcall_list_tab where phone=? or dnc_message like ?");
    s2.setString(1,number);
    s2.setString(2,"%"+smessage+"%");
    ResultSet result=s2.executeQuery();
    rowfound=result.next();
    (Using SQL Server, I am Accepting Parameters from the User by a HTML Page, the user may enter full or partial message, but need to display all the records Satisfying the Criterai
    I tried this but dosnt work for DNC_message Field
    Can anyone help me i am in great need of this

    The problem with that is it produces the following query:
    UPDATE COFFEES SET SALES = 75 WHERE COF_NAME LIKE 'Colombian'Which they also show as a normal Statement (rather than a PreparedStatement) and they claim it will work. Well, in most databases it will work, only if COF_NAME contains exactly "Columbian", just like an "=". If you also want it to return "Columbian Prime" or "Wild Columbian" or whatever, your out of luck without the wildcards, and PreparedStatement does not insert them. If you don't belive it works this way, then test it yourself:
    create table TEST_IT (
      Bogus VARCHAR(20) Primary Key
    insert into TEST_IT values ('AAA');
    insert into TEST_IT values ('ABA');
    insert into TEST_IT values ('ABC');
    SELECT * From Test_It Where Bogus LIKE 'A';
    SELECT * From Test_It Where Bogus LIKE 'AAA';
    SELECT * From Test_It Where Bogus LIKE '%A%';And inspect what the three select statements return.
    Edit: I must apologise, and ask the OP what Driver he is using. This may be somewhat Driver dependent. Using the MySQL 3.1.6 Driver and MySQL 4.1.9, it did not escape the "%" symbols and so
    setString(1, "%A%");returned 3 rows. So the reason yours is not, may be dependent on the Driver and/or vendor. But in any case, the example shown in the tutorial (the Statement version) would still not work (at least in most DBs).

  • Restored nano 6 but i am unable to use any buttons as nothing happens when they are pressed any ideas?

    Hi, i have a nano6 which i have restored. All songs etc have been loaded but  when i press the screen to play etc nothing happens. Any ideas

    Maybe try pressing both the vol. buttons as well as the power button at the same time.

  • Is it possible to use CHAP authentication on an ipad when you are not running a VPN ?

    I can't find an option to switch from PAP to CHAP (like you get in the connection software you get with a 3G dongle)
    Thank you

    Tap Settings > General > Passcode Lock then tap Turn Passcode Off.

  • Get users from Global Address List (GAL) using FindPeople operation of Office 365

    I need to find details of all users using FindPeople operation. If I perform any search by giving value in the <QueryString> element, I get result from both GAL + My Contacts but if I remove the QueryString, I am forced to provide folder name in which
    to search else I get "Internal error" resonse.
    Is there any way I can retrieve/browse all the users in GAL ?

    >> I need to find details of all users using FindPeople operation
    How big is your GAL ? the problem with using a QueryString if you want all users is even if you use a string like SMTP: this will only return the first 100 entires in the GAL. There is a note in the link Laeeq posted that states " When
    searching the GAL as the primary search folder, you must specify a query string instead of a restriction, because this operation does not allow for browsing of the GAL." 
    One way you can use to browse the GAL using this operation is to use the Guid of the Gal (or other address list you want to browse) you can get the Addresslist guid using the Get-GlobalAddressList cmdlet
    http://technet.microsoft.com/en-us/library/aa996579(v=exchg.150).aspx and then you can use code like
    FindPeopleType fpType = new FindPeopleType();
    IndexedPageViewType indexPageView = new IndexedPageViewType();
    indexPageView.BasePoint = IndexBasePointType.Beginning;
    indexPageView.Offset = 0;
    indexPageView.MaxEntriesReturned = 100;
    indexPageView.MaxEntriesReturnedSpecified = true;
    fpType.IndexedPageItemView = indexPageView;
    fpType.ParentFolderId = new TargetFolderIdType();
    DistinguishedFolderIdType contactsFolder = new DistinguishedFolderIdType();
    AddressListIdType adList = new AddressListIdType();
    adList.Id = "2117949e-abe8-4915-91eb-9999f867fd8de";
    fpType.ParentFolderId.Item = adList;
    FindPeopleResponseMessageType fpm = null;
    do
    fpm = esb.FindPeople(fpType);
    if (fpm.ResponseClass == ResponseClassType.Success)
    foreach (PersonaType PsCnt in fpm.People) {
    Console.WriteLine(PsCnt.EmailAddress.EmailAddress);
    indexPageView.Offset += fpm.People.Length;
    else {
    throw new Exception("Error");
    } while (fpm.TotalNumberOfPeopleInView > indexPageView.Offset);
    Cheers
    Glen

  • Cp  operator in select statement

    Hi i am getting error when i write the below select statement, could any one please let me know, how to use  CP operator in select statement
    my code was
    SELECT lifnr name1 FROM lfa1 INTO CORRESPONDING
            FIELDS OF TABLE lt_lfa1 
            WHERE lifnr CP lv_lifnr AND
                  name1 CP  lv_name1.
    Thanks
    Srini
    Message was edited by: Manish Kumar <spoonfeeding, thread locked by moderator>
    Message was edited by: Manish Kumar

    either you have select-options with lifnr and name and use them in the below query as
    SELECT lifnr name1 FROM lfa1 INTO CORRESPONDING
            FIELDS OF TABLE lt_lfa1 
            WHERE lifnr in s_lifnr AND
                  name1 in s_name1.
    else you need to declare internal tables with structure as below..
    DATA: begin of ls_user1,
        sign type c,
        option(2) type c,
        low(90) type c,
        high(90) type c,
       end of ls_user1.
    data: lt_lifnr like ls_user1 occurs 0,
             lt_name1 like ls_user1 occurs 0.
    and then populate these as
    ls_user1-sign = 'I'.
    ls_user1-option = 'CP'.
    ls_user1-low = '*'.  populate with whatever pattern you want
    APPEND ls_user1 TO lt_lifnr
    similarly do it for NAME1 and use them in the query.

  • What is the use of delta in BW side when we have delta in R/3

    Hi,
    what is the use of delta in BW side when we are already using delta in R/3 side?
    Like,
    Generic extraction:-
    with different delta extractions (Time stamp, Calendar day, Numeric pointer).
    Lo-Cockpit extraction with change log method.
    Co/Pa extraction with time stamp method.
    So from this delta activation first time full data will be loaded and after that only changed data will be loaded because of these deltas in R/3 side.
    So now my question is what is the exact use of delta in BW side with ODS/DSO because data already reached to BW with delta activation right.
    Can you please explain me what is the exact use of BW delta?
    Thanks in advance.
    Points to be added.
    Regards,
    Shyam.

    The purpose of Delta Queue is same in R/3 and BW.
    In BW, Delta Queue is used to capture changes made to objects within BW. (for Eg: BW Statastics)or Update data from one BW system to another BW system (if you have multiple BW systems).
    Message was edited by:
            Praveen Vujjini

  • Error while using between operator with sql stmts in obiee 11g analytics

    Hi All,
    when I try to use between operator with two select queries in OBIEE 11g analytics, I'm getting the below error:
    Error Codes: YQCO4T56:OPR4ONWY:U9IM8TAC:OI2DL65P
    Location: saw.views.evc.activate, saw.httpserver.processrequest, saw.rpc.server.responder, saw.rpc.server, saw.rpc.server.handleConnection, saw.rpc.server.dispatch, saw.threadpool.socketrpcserver, saw.threads
    Odbc driver returned an error (SQLExecDirectW).
    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 43113] Message returned from OBIS. [nQSError: 27002] Near <select>: Syntax error [nQSError: 26012] . (HY000)
    can anyone help me out in resolving this issue.

    Hi All,
    Thank u all for ur replies, but I dint the exact solution for what I'm searching for.
    If I use the condition as
    "WHERE "Workforce Budget"."Used Budget Amount" BETWEEN MAX("Workforce Budget"."Total Eligible Salaries") AND MAX("Workforce Budget"."Published Worksheet Budget Amount"",
    all the data will be grouped with the two columns which I'm considering in the condition.
    my actual requirement with this query is to get the required date from a table to generate the report either as daily or weekly or monthly report. If I use repository variables, variables are not getting refreshed until I regenerate the server(which I should not do in my project). Hence I have created a table to hold weekly start and end dates and monthly start and end dates to pass the value to the actual report using between operator.
    please could anyone help me on this, my release date is fast approaching.

  • I am new in using Mac operating system, kindly suggest ebooks , videos or audio books to me so that i can learn more about it?

    i am new in using Mac operating system, kindly suggest ebooks, videos or audio books to me so that i can learn more about it.
    any kind of help would be appriciated. i am very eager to learn.how to make ios application? and how to effectively use terminal? where does the basic programming start in Mac? what are the different tools that can help me make an Mac application and ios application.
    -Thank you
    Shailendra (India)

    Apple has got some great guides to start developing in Objective-C, used for programming OS X and iOS apps > http://developer.apple.com/library/mac/#referencelibrary/GettingStarted/RoadMapO SX/chapters/01_Introduction.html

  • Problem when using About Operator in Contains Query

    Hi,
    I'm new to Oracle and this forums too. I have a problem when using about operator in contains query.
    I create a table with some records and then create a context index on 'name' column.
    CREATE TABLE my_items (
      id           NUMBER(10)      NOT NULL,
      name         VARCHAR2(200)   NOT NULL,
      description  VARCHAR2(4000)  NOT NULL,
      price        NUMBER(7,2)     NOT NULL
    ALTER TABLE my_items ADD (
      CONSTRAINT my_items_pk PRIMARY KEY (id)
    CREATE SEQUENCE my_items_seq;
    INSERT INTO my_items VALUES(my_items_seq.nextval, 'Car', 'Car description', 1);
    INSERT INTO my_items VALUES(my_items_seq.nextval, 'Train', 'Train description', 2);
    INSERT INTO my_items VALUES(my_items_seq.nextval, 'Japan', 'Japan description', 3);
    INSERT INTO my_items VALUES(my_items_seq.nextval, 'China', 'China description', 4);
    COMMIT;
    EXEC ctx_ddl.create_preference('english_lexer','basic_lexer');
    EXEC ctx_ddl.set_attribute('english_lexer','index_themes','yes');
    EXEC ctx_ddl.set_attribute('english_lexer','theme_language','english');
    CREATE INDEX my_items_name_idx ON my_items(name) INDEXTYPE IS CTXSYS.CONTEXT PARAMETERS('lexer english_lexer');
    EXEC ctx_ddl.sync_index('my_items_name_idx');Then I perform contains query to retrieve record :
    SELECT count(*) FROM my_items WHERE contains(name, 'Japan', 1) > 0;
    COUNT(*)
          1
    SELECT count(*) FROM my_items WHERE contains(name, 'about(Japan)', 1) > 0;
    COUNT(*)
          1But the problem is when I using ABOUT operator like in Oracle's English Knowledge Base Category Hierarchy it return 0
    SELECT count(*) FROM my_items WHERE contains(name, 'about(Asia)', 1) > 0;
    COUNT(*)
          0
    SELECT count(*) FROM my_items WHERE contains(name, 'about(transportation)', 1) > 0;
    COUNT(*)
          0I can't figure out what 's wrong in my query or in my index.
    Any help will be appreciated.
    Thanks,
    Hieu Nguyen
    Edited by: user2944391 on Jul 10, 2009 3:25 AM

    Hello (and welcome),
    You'd be best asking this question in the Oracle Text forum, here:
    Text
    And by the way, it will help others to analyse if you put {noformat}{noformat} (lowercase code in curly brackets) before and after your code snippets.
    Good luck!                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Why do we use Allowed Operations in DML Process

    Hello,
    Why do we use Allowed Operations in DML Process ??
    Can you please clear this confusion:
    I am using apex 4.1. oracle 11g R2 SOE ...
    Using the Wizard, I created a Form and IR on Dept Table...
    In the form page:
    - Create Button
    The name is "CREATE"
    NO Database Action
    - DML Process
    Allowed Operations: nothing is checked
    This will insert a new row in the Dept table
    In the form page:
    - Create Button
    The name is "CREATE2"
    Database Action : insert
    - DML Process
    Allowed Operations: nothing is checked
    This will insert a new row in the Dept table
    So, What difference does it make if INSERT check box in Allowed Operations of DML Process is TICKED OR NOT ??
    Regards,
    Fateh

    kdm7 wrote:
    Okay.
    So can we keep a web button to access the www.ni.com ? So that web site opens only when button pressed?
    P.S  I,m a newbie.
    Yes, you can also, e.g. include a help file or manual as html and open that in the browser.
    /Y
    LabVIEW 8.2 - 2014
    "Only dead fish swim downstream" - "My life for Kudos!" - "Dumb people repeat old mistakes - smart ones create new ones."
    G# - Free award winning reference based OOP for LV

  • Error (Error when starting a SWITCH branch) while using container operation

    HI Experts,
    I am using container operation step for moving internal table (ref to sflight) to workarea.The error I found in the log is ' Error when starting a SWITCH branch'.Kindly help me in finding the solution.Below are the steps and code.
    Result Element = lw_sflight             (Element ref to sflight with export and Import)
    Assignment     =    =                     (Assign (contents of table are deleted first)
    Expression      = &FLIGHT&             (Multi line container ref to sflight)
    Operator          = Assignment
    Expression      =                                 (Blank)
    Thanks and Regards,
    Srini

    Hello,
    Maybe you should show more information about the condition step instead of the container operation step.
    A previous poster in SDN said they solved their problem by changing the order of the conditions.
    regards
    Paultje Bakker
    Hanabi Technology

  • Hello guys..does anybody know how to install and use adobe master collection with the new lion?   I need to use Flash and illustratore, but apparently those programmes are incompatible with the new operative sistem...   I am a new mac users and I'd like t

    Hello guys..does anybody know how to install and use adobe master collection with the new lion?
    I need to use Flash and illustratore, but apparently those programmes are incompatible with the new operative sistem...
    I am a new mac users and I'd like to know if there are other similar programmes I can use with lion!

    Lab79 wrote:
    Are you on Apple's payroll?
    well dude I can only let you know that as I work with those programme I don't have to pay for it is my company that pays the programme I whant to use( that's why I was asking if there where other programmes ..that I could use with lion insted that Illustrator and Flash!)..I know Adobe since 2005 and I can say that Adobs products are very good...I think that if it's an Adobe probleme or fault ..they will solve it very soon...but unfortunally I have the impression that after Jobs passed away Appel decided to change politics..and everything started to go very bad! (see FCP X)..
    good luck with apple dude..
    Where is the Apple problem? I have CS4 and CS5 running perfectly fine on my Macbook Pro. Installed 5 after Lion upgrade. Worth every cent. Adobe did have some catching up to do with Lion but with the CS5.5 update all runs fine. But not yours. So it is a problem with the Lion OS? You say you have been with Adobe since 2005. So you would be aware of all the other issues that Adobe had catching up with past Oss in Mac and Windows then. They get it right, but it is up to them. It is not up to Apple, nor Microsoft for that matter, to run around and check that every software developer in the world is running their business properly.
    And what has politics got to do with anything. Some people just have to blame Software for their poor Hardware maintainence of failure of the same.
    <The only think I can really do is to go back on my old windows...give back this orrible lap top and ask for my money back!>
    Great suggestion. You should go with that one, but good luck getting a refund.
    Bye

  • Problem in JDBC , when using LIKE operator. - VERY URGENT

    Problem in JDBC , when using LIKE operator.
    LINE 1 : String temp = "AA";
    LINE 2 : String query = "select * from emp where EMPNAME like '*temp*' ";
    LINE 3 : Staement st = con.createStaement();
    LINE 4 : ResultSet rs = st.executeQuery(query);
    '*' character is not getting evaluated. In MS ACCESS2000 only * is accepted instead of '%'. Moreover in MS ACCESS the like operator has to be used within double quotes as a String. whereas in other databases, it accepts single quotes as a String.
    Ex:
    In MS ACCESS
         select * from emp where ename like "*aa*";
    Other Databases
         select * from emp where ename like '%aa%';
    In my situation iam passing a Variable inside a like operator and '*' is used.
    For the above Scenario, Please help me out.
    If possible Kindly let me know the exact Syntax.
    Please give me the answer as LINE1,LINE2,LINE3,LINE4,
    I have verified in JDBC Spec also, it has been specified to use escape sequence.that too did not work.
    Due to this, My project is in hold for about 4 days. I could not find a suitable solution.
    Please help me out.

    I made a LIKE clause work with M$ Access, using PreparedStatement and the % wildcard:
                escapeStr                   = "%";
                String sql                  = "SELECT USERNAME, PASSWORD FROM USERS WHERE USERNAME LIKE ?";
                PreparedStatement statement = connection.prepareStatement(sql);
                statement.setString(1, ("user" + escapeStr));
                ResultSet resultSet         = statement.executeQuery();
                while (resultSet.next())
                    System.out.println("username: " + resultSet.getObject("USERNAME") + " password: " + resultSet.getObject("PASSWORD"));

Maybe you are looking for

  • I renamed my iMovie folder with my projects in it, and now iMovie  won't open them

    I renamed my iMovie folder with my projects in it and now iMovie  won't open them.

  • Oracle 8 personal edition - Installation problem

    Dear Sirs, I want install on windows xp the database Oracle 8 Personal Edition. I select to install only the database standard without the reply. Start the installatin and when dependency analysis oracle give the error: stopsrvc.vrf{78}: Type mismatc

  • Connecting with a building

    Hi,can anyone help me out, i have three pcs in different rooms, and i have a Cisco work group router, and one of the rooms got an internet connection from a cable modem, and i need to conect the other two rooms so they could access the internet, how

  • Unable to start 9iApplication server

    When I try starting the Oracle 9iApplication Server using the dcmctl command, I get the following error as given below. ADMN-604104 Unable to connect to opmn process to obtain process status table Base Exception: oracle.ias.sysmgmt.exception.ProcessM

  • How to show TV Shows with 20 seasons

    I have a television show in my iTunes with more than 20 seasons but when looking at it in the "Shows" view it only displays Season 1.  Other than changing the Show name on the Video tab, is there any way around this?  My objective is to have this TV