Comma separated data into IN clause in oracle report query

i have a field on form as order number it takes more than one value as 1,2,3
now i want to fetch data in report query for where order no in 1,2 and 3...
but field takes value as 1,2,3...
how can i separte the comma from value and how can i pass value in IN clause...or
how can i get all records with order no 1,2,3...
please suggest how can i achieve the same....

Hi Maddy....
Try this :
declare
var varchar2(10);
v1 varchar2(5);
v2 varchar2(5);
v3 varchar2(5);
vRegExp varchar2(5);
begin
var:='1,2,3'; 
vRegExp:='[^,]+';
FOR i IN 1..length (regexp_replace (var,vRegExp))  + 1
LOOP
            v1 := REGEXP_SUBSTR (var,vRegExp);
            v2 := REGEXP_INSTR(var,vRegExp,1,2);
            var := substr(var,v2);
           // here fetch you data from report by passing v1 as a parameter;
      EXIT WHEN v2 = 0;
END LOOP;
end;
Hope this will resolve your question..
Thanks

Similar Messages

  • Comma separated data to array

    I am looking for a method to translate a string with comma separated data into an array or vector.

    Hello rolivawdaneel, I hope this help you, this takes the string a returns a vector.
    import java.util.StringTokenizer;
    import java.util.Vector;
    public class stringConverter {
        public static Vector toVector( String s ) {
            Vector result = new Vector();
            StringTokenizer st = new StringTokenizer( s, "," );
            while( st.hasMoreTokens() ) {
                String aTokenizedString = st.nextToken();
                result.addElement( aTokenizedString );
            return result;
    }

  • Need to Convert Comma separated data in a column into individual rows from

    Hi,
    I need to Convert Comma separated data in a column into individual rows from a table.
    Eg: JOB1 SMITH,ALLEN,WARD,JONES
    OUTPUT required ;-
    JOB1 SMITH
    JOB1 ALLEN
    JOB1 WARD
    JOB1 JONES
    Got a solution using Oracle provided regexp_substr function, which comes handy for this scenario.
    But I need to use a database independent solution
    Thanks in advance for your valuable inputs.
    George

    Go for ETL solution. There are couple of ways to implement.
    If helps mark

  • How to populate the Quering data into Excel sheet in Oracle

    Dear Guys,
    How to populate the Quering data into Excel sheet in oracle.
    Please provide a solution.
    Thanks & Regards,
    Senthil K Kumar

    Hi
    To make Excel sheets from sqlplus, you can use the markup html tag in sqlplus.
    Here's an example.
    Example
    <code>
    SET LINESIZE 4000
    SET VERIFY OFF
    SET FEEDBACK OFF
    SET PAGESIZE 999
    SET MARKUP HTML ON ENTMAP ON SPOOL ON PREFORMAT OFF
    SPOOL c:\test_xls.xls
    SELECT object_type
    , SUBSTR( object_name, 1, 30 ) object
    , created
    , last_ddl_time
    , status
    FROM user_objects
    ORDER BY 1, 2
    SPOOL OFF
    SET MARKUP HTML OFF ENTMAP OFF SPOOL OFF PREFORMAT ON
    SET LINESIZE 2000 VERIFY ON FEEDBACK ON
    </code>

  • How to include the UDF of items master data into PLD (Inventory in Warehouse Report (Detailed))

    Hi,
    Is there a way to include the UDF in the items master data into the <<Inventory In Warehouse Report (Detailed)>> PLD?
    I checked the default layout and found out all the column source type is "free text" and the content is #Item, how do I know the value of the UDF?
    Thanks

    Hi,
    Some of the standard reports are hardcoded in sap. Not possible to add UDF field in PLD.
    Also refer this thread Variables -  Sap business one
    Thanks & Regards,
    Nagarajan

  • Inserting the Comma Separated Strings into Table

    Hi Seniors,
    i had two string and i want to insert the records in the Table COMMENT . In this way.
    would u please give some programe to insert the records.
    The Data and the Table
    ( 901,902,903,904 )
    ( 'hai','nice','good & mail is [email protected] ','excellent and the phone 011-235323' )
    comm_id loc_id company_name comments
    1      10 901      Hai
    2      10 902      nice
    3 10      903      good & mail is [email protected]
    4      10 904      excellent and the phone 011-235323
    Thanks
    Seenu

    Hi, Seenu,
    In Oracle 10 (and up) you can easily split a comma-delimited list using REGEXP_SUBSTR.
    INSTR and SUBSTR can do the same thing in any version, but it's more complicated.
    See the general instructions below:
    /*     How to Split a Delimited String
    This shows how to take a single row with a delimited string, such as
         Animal     amoeba,bat,cedusa,dodo
    and transform it into multiple rows:
         Animal     1     amoeba
         Animal     2     bat
         Animal     3     cedusa
         Animal     4     dodo
    PROMPT     ==========  -1. sep_char parameter  ==========
    VARIABLE     sep_char     VARCHAR2 (10)
    EXECUTE     :sep_char := ',';
    SELECT     :sep_char     AS sep_char
    FROM     dual;
    PROMPT     ==========  0. string_test table  ==========
    DROP TABLE     string_test;
    CREATE TABLE     string_test
    (     grp_name     VARCHAR2 (10)
    ,     list_txt     VARCHAR2 (50)
    INSERT INTO string_test (grp_name, list_txt) VALUES ('Animal',     'amoeba,bat,cedusa,dodo');
    INSERT INTO string_test (grp_name, list_txt) VALUES ('Date',     '15-Oct-1582,16-Oct-2008');
    INSERT INTO string_test (grp_name, list_txt) VALUES ('Nothing',     NULL);
    INSERT INTO string_test (grp_name, list_txt) VALUES ('Place',     'New York');
    INSERT INTO string_test (grp_name, list_txt) VALUES ('Skip',     'Hop,,Jump');
    SELECT     *
    FROM     string_test
    ORDER BY     grp_name;
    PROMPT     ==========  Q1.  Oracle 11 Query  ==========
    WITH     cntr     AS          -- Requires Oracle 9
    (     -- Begin sub-query cntr, to generate n (1, 2, 3, ...)
         SELECT     LEVEL     AS n     -- Requires Oracle 9
         FROM     dual
         CONNECT BY     LEVEL     <= 1 +     (
                             SELECT     MAX ( REGEXP_COUNT (list_txt, :sep_char) )     -- Requires Oracle 11
                             FROM     string_test
    )     -- End sub-query cntr, to generate n (1, 2, 3, ...)
    SELECT     grp_name
    ,     n
    ,     REGEXP_SUBSTR     ( list_txt     -- Requires Oracle 10
                   , '[^' || :sep_char || ']'     -- Anything except sep_char ...
                        || '+'               -- ... one or more times
                   , 1
                   , n
                   )     AS item_txt
    FROM     string_test
    JOIN     cntr                                   -- Requires Oracle 9
    ON     n     <= 1 + REGEXP_COUNT (list_txt, :sep_char)     -- Requires Oracle 11
    ORDER BY     grp_name
    ,          n;
    /*     Notes:
         REGEXP_SUBSTR (s, '[^,]+', 1, n)
    returns the n-th item in a comma-delimited list s.
    If there are fewer than n items, it returns NULL.
    One or more consecutive characters other than comma make an item, so
    'Hop,,Jump' has two items, the second one being 'Jump'.
    The sub-query cntr produces a list of integers 1, 2, 3, ..., w
    where w is the worst-case (the largest number of items in any list).
    This actually counts separators, not items, (e.g., it counts both
    commas in 'Hop,,Jump', even though), so the w it produces may be
    larger than is really necessary.  No real harm is done.
    PROMPT     ==========  Q2. Possible Problems Fixed  ==========
    WITH     cntr     AS
    (     -- Begin sub-query cntr, to generate n (1, 2, 3, ...)
         SELECT     LEVEL     AS n
         FROM     dual
         CONNECT BY     LEVEL     <= 1 +     (
                             SELECT     MAX ( REGEXP_COUNT (list_txt, :sep_char) )
                             FROM     string_test
    )     -- End sub-query cntr, to generate n (1, 2, 3, ...)
    SELECT     grp_name
    ,     n
    ,     REGEXP_SUBSTR     ( list_txt
                   , '[^' || :sep_char || ']'     -- Anything except sep_char ...
                        || '+'               -- ... one or more times
                   , 1
                   , n
                   )     AS item_txt
    FROM     string_test
    JOIN     cntr          ON n     <= 1 + NVL     ( REGEXP_COUNT (list_txt, :sep_char)     -- Problem (1)
                                  , 0
    WHERE     REGEXP_SUBSTR     ( list_txt     -- Problem (2)
                   , '[^' || :sep_char || ']'     -- Anything except sep_char ...
                        || '+'               -- ... one or more times
                   , 1
                   , n
                   )     IS NOT NULL
    OR     list_txt     IS NULL          -- Problems (1) and (2) together
    ORDER BY     grp_name
    ,          n;
         (Possible) Problems and Fixes
    (1) If list_txt IS NULL, then REGEXP_COUNT (list_txt, :sep_char)
         returns NULL, the join condition fails, and the output
         contains nothing corresponding to the row from string_test.
         If you want a NULL item to appear in the results, use
         NVL to make sure the expression returns 0 instead of NULL.
    (2) If list_txt contains multiple consecutive sep_chars (or if it
         begins or ends with sep_char, then the original query
         will return NULL items.  To suppress these, add a WHERE
         clause to test that the item_txt to be displayed IS NOT NULL.
    PROMPT     ==========  Q3. Oracle 8.1 Query  ===========
    SELECT     grp_name
    ,     n
    ,     SUBSTR     ( list_txt
              , begin_pos
              , end_pos - begin_pos
              )     AS item_txt
    FROM     (     -- Begin sub-query to compute begin_pos and end_pos
         SELECT     grp_name
         ,     n
         ,     list_txt
         ,     INSTR     ( :sep_char || list_txt
                   , :sep_char
                   , 1
                   , n
                   )     AS begin_pos
         ,     INSTR     ( list_txt || :sep_char
                   , :sep_char
                   , 1
                   , n
                   )     AS end_pos
         FROM     string_test
         ,     (     -- Begin sub-query cntr, to generate n (1, 2, 3, ...)
              SELECT     ROWNUM     AS n
              FROM     all_objects
              WHERE     ROWNUM     <= 1 +     (
                             SELECT     MAX     ( LENGTH (list_txt)
                                       - LENGTH (REPLACE (list_txt, :sep_char))
                             FROM     string_test
              )     -- End sub-query cntr, to generate n (1, 2, 3, ...)
              cntr
         WHERE     n     <= 1 +     ( LENGTH (list_txt)
                        - LENGTH (REPLACE (list_txt, :sep_char))
         )     -- End sub-query to compute begin_pos and end_pos
    ORDER BY     grp_name
    ,          n;
    /*     Version-Dependent Features and Work-Arounds
    The code above, Q3, runs in Oracle 8.1.
    The following changes were made to Q1:
    (11) REGEXP_COUNT was introduced in Oracle 11.
         In earlier versions, to find the number of sep_chars in list_txt,
         see how much the LENGTH changes when sep_chars are removed.
    (10) REGEXP_SUBSTR was introduced in Oracle 10.
         In earlier versions, use INSTR to find where the sep_chars are,
         and use SUBSTR to get the sub-strings between them.
         (Using this technique, 'Hop,,Jump' still contains three items,
         but now item 2 IS NULL and item 3 is 'Jump'.)
    (9.a) The WITH-clause was introduced in Oracle 9
         In earlier versions, use in-line views.
    (9.b) "CONNECT BY LEVEL < constant" doesn't work in Oracle 8.
         Use ROWNUM from any sufficiently large table or view instead.
    (9.c) ANSII join notation (JOIN table_name ON ...) was introduced in Oracle 9
         In earlier versions, join condition go in a WHERE-clause.
    */

  • How could I Write data into a field in Oracle whose data type is VARCHAR2

    The target data I want to write into Oracle is in http://tw.yahoo.com/info/utos.html.
    Now, these data is stored in Mysql database and the field which stores these data uses "Text" as its data type.
    I want to derive these data from mysql database and store them into a field of oracle database.
    In oracle, I create field whose data type is varchar2(4000) to store these data.
    I use JSP to derive data from mysql and insert into oracle through JDBC.
    But the result of the page shows me that "javax.servlet.ServletException: Data size bigger than max size for this type: 25623".
    Please anyone could help to resolve this problem?
    Thank you very much.

    My hunch is that the problem is that VARCHAR2(4000), but default, allocates 4000 bytes of storage. Depending on your database character set, a single character may require up to 4 bytes of storage.
    If you are on 9i, you can declare the column VARCHAR2(4000 CHAR) to allocate 4000 characters of storage. You can also set NLS_LENGTH_SEMANTICS to CHAR, which will cause Oracle to assume that your declarations are in characters rather than bytes.
    Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • How to insert data into local database from oracle server

    I am new in C#.
    I am trying to design a local database in my C# project and I am trying to sync my database with our oracle server. I can login using oracle server. But I can't insert data into my local database from oracle server.
    anybody can help me ...............
    thanks..............................

    You can use SSIS package for that
    Start a new Integration Services project in Business  Intelligence Development Studio/ SSDT. Add a new SSIS package with a data flow task. Add a OLEDB source to connect to Oracle server and add a OLEDB Destination to connect to your local database.
    Select tables for source and destination. On executing package source data will get transferred to your local database.
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • PostChanges()  commit the data into MySQL with engine=MyISAM

    suddenly i found the following code called in AM could commit the change into database .
    this.getTransaction().postChanges();
    My database is MySQL 5.0,and set it with MyISAM engine .i know this engine can not support transaction.

    Hi,
    In the same step 4, please try the option pure SQL and enter the query, "select count(*) from tablename"
    Please check whether this is working fine ? And also, were you able to see the records in the JDeveloper IDE with the connecting to the MySQL Database...
    And aslo, the data source you have created for accessing the mySQL Database in weblogic console, what username credentials have you given ? please check whether that username has privileges to the table you want to select ? And , the table you are selecting is under the same username schema or another schema ? If it is a different schema , then find out whether the username you have given while creating the data source has read/write privileges to that table ?
    Thanks,
    N

  • Converting comma separated string into rows

    for my procedure  varchar2 is i/p paramter. i will get this i/p from java. this string value is like  'VTP,VR','VM'.
    i want to split taht string into rows  ie o/p will be
    VTR
    VR
    VM.
    how to do this.

    Hi,
    As always, the solution depends on your data, your requirements, and you Oracle version.
    Here's one way:
    -- Simulating Java input with a bind variable:
    VARIABLE  str VARCHAR2 (100)
    EXEC     :str := 'VTP,VR,VM';
    SELECT  LEVEL  AS n
    ,       REGEXP_SUBSTR ( :str
                          , '[^,]+'
                          , 1
                          , LEVEL
                          ) AS str_part
    FROM     dual
    CONNECT BY LEVEL <= 1 + REGEXP_COUNT (:str, ',')
    I'm just guessing that your original string doesn't include single-quotes after VR or before VM.  If it does, you can use TRIM to remove them from the string passed back by REGEXP_SUBSTR.

  • Comma separated column into rows for each value

    experts,
    I have a two column table. The second column has comma separated string values. How can I put the values separate for each comma separated and make one row for each value?
    example,
    column1 |   StringColumn
    s1          |   test, joy, happy
    s2          |  USA, England, India
    I want the result to be like below
    column1   |     StringColumn
    s1            |      test
    s1            |      joy
    s1            |      happy
    s2            |     USA
    s2            |     England
    s2            |     India
    thanks in advance
    ebro

    Hello ebro,
    See the following for a possible solution:
    http://gallery.technet.microsoft.com/scriptcenter/Convert-Small-CSV-Value-to-ffc142ff
    Olaf Helper
    [ Blog] [ Xing] [ MVP]

  • How to insert date into ms access database using sql query in servlet

    sir all thing is working well now only tell me how we can insert date into ms access database which is input by user .
    insert into db2(bookname,studentname,date) values('"+bname+"','"+sname+"',date_format)";{code}
    or either the system date is inserted with query .
      plz help me
    thanx                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    bhavishya wrote:
    sir all thing is working well now only tell me how we can insert date into ms access database which is input by user .
    insert into db2(bookname,studentname,date) values('"+bname+"','"+sname+"',date_format)";{code}
    or either the system date is inserted with query .
    plz help me
    thanxAnd that SQL statement is another reason to use PreparedStatement. I assume bname and sname are input from some form? Well, if that's the case, simply inserting them into SQL by simple String concatenation is just begging for all sorts of problems. What if there is an apostrophe in the entry? Broken Statement. Worse, it's a wide open invitation to an SQL Injection attack.

  • Is it possible to insert data into two Excel worksheets using Report Generation Toolkit?

    I'm using the toolkit to insert data into two separate worksheets in Excel using named cells. The problem is that it tends to favor one sheet or the other. In other words, one sheet will have data and the other no data and vice versa. (Sometimes I get data in both sheets.) Is there something I can do to clear this up or is what I'm trying to do unreasonable? I would like to use two worksheets so one sheet receives text and data. The other sheet is used to format the data into a printable report. (i.e. using Excel's CONCATENATE function) The second (report) sheet is also used to receive plots (JPEG files) from LabVIEW. I'd send the plot images to the first sheet, but I can
    not see a way to automatically transfer images from sheet to sheet. I'm using LV 7.1, Win2000 and Toolkit v.1.0.1

    Hi,
    You can use the "Excel Get Worksheet.vi" under All Functions >> Report Generation >> Excel Specific >> Excel General to specify a particular worksheet as the current worksheet. Then, you can specify which worksheet you want to write to in your VI.
    Let me know if you have any further questions and good luck!
    Kileen C.
    NI

  • Need to Pass Active Directory Attributes into OBIEE for use in Report Query

    Hi,
    We're using OBIEE 11.1.1.5 and have integrated it with AD security. Users successfully log into OBIEE and BIP (which is integrated with OBIEE) using their network/AD accounts.
    Next step for us is to be able to pass some AD attributes that are on the user accounts into OBIEE and BIP so we can restrict data queries for the person logged in.
    I've searched the web and so far have only come up with specific steps for setting this up in BIP. Since BIP is integrated with OBIEE, we have not set any of the MSAD/LDAP security up there - it is all in OBIEE. I have been unable to find the equivalent for adding the attribute names for data query bind variables.
    With our current setup, we are unable to filter the report data automatically based on who has logged into the application (analytics and BIP). We have security setup within the catalog so only certain AD groups can access objects, but beyond that we need to be able to secure the data using AD attribute information. For example, all of our users should be able to access an Open Purchase Order report, but they should only be able to see their own purchase orders - not everyone in the company.
    Anyway, we're looking to be able to pass AD attributes into OBIEE so that we can use this data in our Analytics and BIP queries.
    How can we get this setup?
    Thank you in advance!
    Suzanne

    A fairly common problem, see:
    http://www.williamrobertson.net/documents/comma-separated.html
    http://www.oracle-base.com/articles/misc/DynamicInLists.php
    http://tkyte.blogspot.com/2006/06/varying-in-lists.html

  • Oracle Report Query

    Hi Experts,
    we have oracle EBS 11i (11.5.10.2) .
    I am registering the oracle report with From and To Date parameters and want to validate the To Date should be >= From Date .
    How can I validate it ?
    regards
    Sanjay

    Hi Sanjay,
    You can do this by using the Range option while defining your parameters.
    1. Define the From Date parameter in the Concurrent Program parameters window. On the right side of the window, you will see the Range option, select 'Low' from the list.
    2. Define the To Date parameter. In the Range option, select 'High' from the list.
    Users will be forced to enter To Date>=From Date
    Regards,
    Sujoy

Maybe you are looking for

  • Animation fully runs in Chrome and Opera, not in any other browsers

    All, I created an extensive animation with images and sounds (*.mp3 and *.wav files) using Adobe Edge Animate for a website I'm creating for a client. I've uploaded everything to the host, which is Shopify, and the animation works in Google Chrome an

  • IPod Refuses To Sync Video

    Hey, I have a 5th Generation iPod nano, roughly 8 gigs. I recently downloaded a video and iTunes is refusing to sync it. JUST that one video, I DO NOT need to convery the video, it's an .mp4. I can't figure out what's going on, it plays fine in iTune

  • Epub formatting questions.

    Hi, I've read that the epub format does not support tabs. What should I do as a substitute? Does it support actual regular spacebar spaces instead? How about for paragraph returns...do I use the 'return' key to add large gaps of space between content

  • How long does it take for the Genius Bar to replace the bottom case of my Macbook?

    I bought this Macbook on Christmas Eve '09 and by last year summer, the bottom casing was peeling off and I now know that Apple is replacing macbook bottom cases free of charges regardless of warranty status. What I would like to know is, if I take i

  • Rows in columns

    I have two tables table x and y table x has two column name to_group and from_group . Table y has two columns group_name and email id. I want to join these two table which do not have any common . x.from_group=y.group_name x to_group from group A B B