Passing selection several values in a query

I have a statement select mulit combines all the values selected by a: (item1:item2:item3) and so forth, to present that entry is passed to a query for results.

I need to pass this value to a query using 'where X (value mutliselect) '.

This will format the string correctly
Select "' | Replace (: p1_port, ':', "'|) ',' ||'' ') ||'' ' the double

and create output like > "ABU DHABI", "ANCHORAGE."

If I take it out and run it in this query, I get results:

SELECT distinct container_number,
Description,
container_seal,
date_of_arrival
OF apps.xahg_app_package_detail_v
Destination WHERE ("ABU DHABI", "ANCHORAGE")

But if I try to combine the 2 as this query:

SELECT distinct container_number,
Description,
container_seal,
date_of_arrival
OF apps.xahg_app_package_detail_v
WHERE IN destination (select "': replace (: p1_port, ':',"'|)) ',' ||'' ') ||'' (' double)

or even this one:

SELECT distinct container_number,
Description,
container_seal,
date_of_arrival
OF apps.xahg_app_package_detail_v
WHERE IN destination ("': replace (: p1_port, ':',"'|)) ',' ||'' ') ||'' ')

I will return no results... or a mistake by the way, I'm totally stumped here seems to be a fairly simple thing to make it work? It makes no sense, why would one hard-coded return values but parameter entries will not be... don't forget the hardcoded used n-cut-paste the results of the ' select "' | Replace (: p1_port, ':', "'|) ',' ||'' ') ||'' 'of the double' sample.

is there something that I am missing?

Thanks in advance,
Jeremy

Try this

SELECT distinct container_number,
Description,
container_seal,
date_of_arrival
OF apps.xahg_app_package_detail_v
WHERE INSTR (': ' |: p1_port |': ',' :'|| destination: ': ') > 0
;

Just to clarify.

' :'|| : p1_port |': ' make sure your string is delimited by hyphens.

':'|| destination: ': ' make sure your string is delimited by hyphens.

If your destination is the string INSTR will return a positive value, 0 otherwise. I also assumed that nothingness: P1_port or destination may include the ":" character.

Tags: Database

Similar Questions

  • How can I select several values for popup LOV

    Hello
    I need to select several values for popup lov. Is it possible to select several values from popup lov


    Concerning
    Veronica B

    Check your page now, added a javascript in shared components file > images and a css in the components share > cascading style sheets

    I used the plugin below
    http://www.erichynds.com/jQuery/jQuery-UI-MultiSelect-Widget/

  • How to select several values with a select statement with other columns

    Hi all

    I have a small request related to the selection of values in a table.

    create table employees (eid, ename varchar2 (20));

    insert into employee values (1, 'Nik');

    insert into employee values (2, "Prashant");

    commit;


    Now, I have a small list of say A, b, C, I want to choose this list with all the lines as

    with test1 as)

    Check the eid, ename for employee

    )

    Select eid, ename, 'A' col1 in test1

    UNION ALL

    Select eid, ename, 'B' col1 in test1

    UNION ALL

    Select eid, ename, 'C' col1 in test1

    but the problem with that is that in production my employee table has millions of records and it scans the employee three times table (or the number of constant values)

    Is there another way to do this.

    Thank you

    Nik

    Here is an approach with the scanning of a single table test1

    Select t.eid, t.ename, c.col1

    t test1

    Cross join (select 'A' col1 of union double all the)

    Select 'B' of all the double union

    Select the double ' C') c

  • How to use the multiple selection list values in sql query

    Hi all
    In the search form, I have a multiselect llist tell (P3_STATUS) and I want to have a query using this element and fetch documents
    How to do a sql query based on the selection of the value of this element.
    SELECT "W"."START_DT" "Start Date",
           "W"."CAMPAIGN_CODE" "Campaign Name",  
           "W"."MKT_CHANNEL" "Channel",
           "W"."MKT_SUB_CHANNEL" "Sub Channel", 
           "W"."PROMO_CODE" "Promo Code",
           "W"."TRACKING_CODE" "Tracking Code",
           "W"."TFN" "TFN",
           "W"."STATUS" "Status",
           "W"."CAMPAIGN_CODE" "Edit"
           FROM 
             "WC_MKT_CAMPAIGN_DS" "W"
      
           WHERE 
         (MKT_CHANNEL = decode(:P1_CHANNEL,'%null%',MKT_CHANNEL,NULL,MKT_CHANNEL,:P1_CHANNEL))
       AND
    (MKT_SUB_CHANNEL= decode(:P1_SUB_CHANNEL,'%null%',MKT_SUB_CHANNEL,NULL,MKT_SUB_CHANNEL,:P1_SUB_CHANNEL))
    AND *STATUS = decode(.................*
    Please could someone help me on this?

    Thanks in advance
    Robert L

    Try to change your selection of status to

    AND INSTR(':'||:P3_STATUS||':',':'||STATUS||':') > 0
    
  • Select several values max

    Hello world
    I need to help you prepare a query
    So I have a table that looks like this
    ID times
    1 10
    1 11
    2 12
    2 13
    1 14
    3 15
    3 16
    And I need to get for each ID that is a minimum of time and and time then maximum is less than a minimum for this ID
    So it would look like this
    ID tempsMin TimeMax
    1-10-
    2-12-11
    3 15 14

    Please help me with this!
    with data as (
    select 1 id, 10 time from dual union all
    select 1,11 from dual union all
    select 2,12 from dual union all
    select 2,13 from dual union all
    select 1,14 from dual union all
    select 3,15 from dual union all
    select 3,16 from dual
    )
    
    select
      id
    , min(time) timemin
    , min(lt) keep (dense_rank first order by lt nulls first) timemax
    from (
      select
        id
      , time
      , lag(time) over (order by time) lt
      from data
    )
    group by
     id
    
    ID     TIMEMIN     TIMEMAX
    1     10     -
    2     12     11
    3     15     14
    
    would be a little bit simpler if you could stand 0 instead of null
    
    select
      id
    , min(time) timemin
    , min(lt) timemax
    from (
      select
        id
      , time
      , lag(time, 1, 0) over (order by time) lt
      from data
    )
    group by
     id
    
    ID     TIMEMIN     TIMEMAX
    1     10     0
    2     12     11
    3     15     14
    

    concerning

    Edited by: chris227 the 19.07.2012 16:28

  • Passing multiple column values in operator.

    Hello

    I have a sub query that returns values as below.
    -----
    Col1 Col2 Col3
    -----
    Date2 Date1 Prod1
    Date4 Date3 Prod2
    Prod4 date.5 Date6
    -----

    I need to pass these three values to a query that retrieves values based on the values passed.

    My query will be something like

    Select * from TAB1 where produced IN (Prod1) and PurchaseDate between Dat1 and Date2

    For
    Prod1, Date1 and Date2 must be passed as input
    Prod2, Date3 and Date4 must be passed as inputs... so now...

    Thank you.

    You must use a join, not the query sub...

    select *
    from tab1 a,tab2 b
    where a.prod = b.prod
    and a.date_col betwen b.date_col1 and b.date_col2;
    
  • ADF select several shuttles become read only when the value is

    Hello

    I want to ask about the select oracle ADF that many shuttle.

    Recently, I want to create a shuttle a lot with the pre value is set in the right box, select. When I try to set the value of the shuttle to select several properties. The shuttle many select transformed into an object as input like the image below text

    a.png

    but when I'm not set to select several shuttles it became normal like that

    b.png

    the method that I put in the value property is like that

    public list < BidClassification > getListBidClassificationTaken() {}

    finalClassification = new ArrayList();

    The OperationBinding class method = ADFUtil.getMethodBinding ("retrSupSupplierClassificationFindAllBySupplierId");

    method.getParamsMap () .put ("supplierId", getSelectedSupplier () .getId ());

    List < BidClassification > finalClassification = method.execute () (list < BidClassification >).

    Return finalClassification;

    }

    the method that I use to set the position data is like this

    public list < SelectItem > getListBidClassification() {}

    retval = new ArrayList();

    The OperationBinding class method = ADFUtil.getMethodBinding ("retrBidClassificationFindAll");

    listBidClassification = (list < BidClassification >) method.execute ();

    for (BidClassification bc: listBidClassification) {}

    SelectItem item = new SelectItem();

    item.setLabel (bc.getId ());

    item.setValue (bc);

    retval. Add (Item);

    }

    Return retval;

    }

    I have already replace the method equal in the BidClassification class so there will be no more no problem

    Header 1

    < af:selectManyShuttle label = 'Grading' id = 'sms1"binding =" #{backingBeanScope.backing_vendorEdit.sms1} ' "

    leadingHeader = 'Ranking Master' trailingHeader = 'Grading of provider' >

    < f: selectItems value = "#{backingBeanScope.backing_vendorEdit.listBidClassification}" id = "si1" "

    Binding="#{backingBeanScope.backing_vendorEdit.SI1}"/ >

    < / af:selectManyShuttle >

    This the jsff xml where I put the shuttle several select no defined value

    < af:selectManyShuttle label = 'Grading' id = 'sms1"binding =" #{backingBeanScope.backing_vendorEdit.sms1} ' "

    leadingHeader = 'Ranking Master' trailingHeader = 'ranking of provider.

    value = "#{backingBeanScope.backing_vendorEdit.listBidClassificationTaken}" >

    < f: selectItems value = "#{backingBeanScope.backing_vendorEdit.listBidClassification}" id = "si1" "

    Binding="#{backingBeanScope.backing_vendorEdit.SI1}"/ >

    < / af:selectManyShuttle >

    Select this the jsff xml where I put the shuttle well with the value

    someone has an idea of what's going on with this code? ___. thx a lot btw

    @

    Yeay! I already fix it!

    BTW who behave the same as me.

    You must make a note on the setter and the Get accessor of the variable list you use

    * in my case, I don't implement the setter method and the list setter method

    THX.

  • I created a PDF form with several drop downs, all with the same drop-down values. When I select a value of 1 in the drop-down list fields, it breeds in all others - which I don't want. How can I fix?

    I created a PDF form with several drop downs, all with the same drop-down values. When I select a value of 1 in the drop-down list fields, it breeds in all others - which I don't want. Can I fix?

    I am fairly new to this, but I think it has to do with the way you have drop them downs named. Copy you a then keep stick in each area? If so, that's the problem. You must rename each with a different number: Dropdown1, Dropdown2, etc. I think this might solve the problem.

  • selecting a value in the drop-down list but page must not get recharged again.

    Hello
    I created a drop-down list. After you have selected a value from him, I can get a value in the box of text below according to updon one sql query. but the problem is that I HAV to select Page Action when the changed value parameter to the set value and redirect. Thanks to her whenever I have to select a value from the drop-down list, page get updated. Is there a way that will satisfy the requirement but page does not get new dependants.
    I use apex 4.2.
    Thank you

    You can create A dynamic Action to set the value while changing the value in the Select list (drop-down list).

    Event: change
    Selection type: item (s)
    Article (s): choose your selection list item
    Action: Execute the PL/SQL Code
    PL/SQL code:

    begin
    select colum_name into :Px_text_item_name from table where column_name=:px_select_list_name;
    end;
    

    Page elements to send: px_select_list_name
    Page referred to return: Px_text_item_name

    Its work for me without refreshing the page. Assume that, if you want to pass this value to the element in another page, then use the branch for redirection and assign the value to the element on the page of another.

    Thank you
    Lacombe

  • Several counts in a query

    Hello

    I try to enter a query on several counts.
    Each county queries work perfectly well when done separately, but the problem comes when I try to use them together.
    The code is like this:

    SELECT
    (SELECT count (*) FROM variable randomtable WHERE = 'first') as good1,.
    (SELECT count (*) FROM variable randomtable WHERE = "second") as good2

    Should appear something similar to:
    Good1 good2
    12 8

    Basically, the goal here is just to get the account numbers will appear.
    The problem that I am running is that the first SELECT statement forces me to get a table FROM, that I don't need.
    If I insert a table, then the counties will show up in the number of lines that appear in the table OF.
    It will end up showing something like:
    Good1 good2
    12 8
    12 8
    12 8
    12 8
    12 8
    etc.


    Is there something I'm missing here or do I need an alternative?

    Thank you!

    Add:
    of the double

    But if you select several times in the same table, then you don't need to write a new call to this table each time. Possible is also present

    select count(case when variable = 'first' then 1 else null end) as good1,
             count(case when variable = 'second' then 1 else null end) as good2
    from randomtable ;
    

    This works because NULL values are not counted.

    Published by: Sven w. September 18, 2012 21:44

  • Move several images in the query editor?

    Hello! Is it possible to move several images in the query editor (CS4)? As now I have to move them one by one and it's hard so that they retain their values shift coz + move doesn't seem to not work. Or does?

    Best regards / Jimmy

    You can move multiple KeyFrames property for a unique property in the query editor. Maj-Maj-clic click on them, and then drag. You cannot move across different properties, however.

    If you want to move * all * keyframes on multiple images, you want to do this on the main timeline. CTRL/cmd + glisser drag on the frames to select multiple pictures, then drag them on the beach of interpolations.

  • [8i] need to combine several values in a column

    I work in 8i...

    I have data as follows:
    CREATE TABLE item_year
    (     item_no     CHAR(25)
    ,     year     CHAR(4)
    );
    
    INSERT INTO item_year
    VALUES ('item1','1998');
    INSERT INTO item_year
    VALUES ('item1','2002');
    INSERT INTO item_year
    VALUES ('item1','2003');
    INSERT INTO item_year
    VALUES ('item1','2004');
    INSERT INTO item_year
    VALUES ('item2','1984');
    INSERT INTO item_year
    VALUES ('item2','1991');
    INSERT INTO item_year
    VALUES ('item2','2006');
    INSERT INTO item_year
    VALUES ('item2','2008');
    INSERT INTO item_year
    VALUES ('item2','2010');
    The results that I want are:
    ITEM_NO     YEARS
    ------------------------------
    item1     1998, 2002, 2003, 2004
    item2     1984, 1991, 2006, 2008, 2010
    My inclination is to rotate the results, but my problem is, I don't know how many years will see room for a particular item. In theory, it could it upwards in each year between any point in the past through the current year. In practice, the year is 1997, and I can't think of any situation where an older date occur in the future, because this table is a table of history. Thus, at the present time, the years, I would need to look to be 1997-2010, but of course, would come January, it will be 1997-2011, etc.. So either way is for me to do without having to create a procedure or something?

    Hello

    You can do the slightly simpler query by losing the CONNECT BY. In the example that you copied, CONNECT BY was the only way to get the items that should be grouped together. In your case, a simple query will do:

    SELECT     item_no
    ,     CAST ( MULTISET ( SELECT    year
                            FROM         item_year
                     WHERE         item_no     = all_item_nos.item_no
                     ORDER BY  year
                   )
                AS myArrayType
              )          AS years
    FROM    (
             SELECT DISTINCT  item_no
             FROM             item_year
         ) all_item_nos
    ;
    

    I don't know how to get a simple string (rather than myArrayType) for results without the help of PL/SQL.

    If you use the PL/SQL, you might consider this approach: write a function that takes an id (like item_no) as an argument and returns a string (the list or results). You probably want several similar functions for the different arguments, tables and columns. If Yes, you can isolate the part that actually built the chain to verify that the results are actually in the allocated space, in a generic function (such as concat_query, below) and to call this generic function to a specific function (such as all_years, below) adapted to a specific situation.
    This is a package that contains the generic function:

    CREATE OR REPLACE PACKAGE     string_agg
    AS
    
    TYPE     concat_query_cursor_type     IS     REF CURSOR
         RETURN     dual%ROWTYPE;
    
    FUNCTION concat_query
    (
         in_cursor          IN     concat_query_cursor_type,
         in_separator_txt     IN     VARCHAR2
    )
    RETURN     VARCHAR2
    ;
    
    END     string_agg;
    /
    SHOW ERRORS
    
    CREATE OR REPLACE PACKAGE BODY string_agg
    AS
    
    FUNCTION concat_query
    (
         in_cursor          IN     concat_query_cursor_type,
         in_separator_txt     IN     VARCHAR2
    )
    RETURN     VARCHAR2
    IS
         c_txt          VARCHAR2 (4000);
         return_txt     VARCHAR2 (4000) := '';
         return_max_val     INTEGER := 4000;     -- declared size of return_txt
         row_cnt          INTEGER := 0;          -- number of pa records found so far
    BEGIN
         LOOP
              FETCH  in_cursor  INTO  c_txt;
              EXIT  WHEN  in_cursor%NOTFOUND;
    
              IF  row_cnt > 0
              THEN
                   c_txt := in_separator_txt || c_txt;
              END IF;
    
              IF  LENGTH (return_txt) + LENGTH (c_txt) > return_max_val
              THEN
                   c_txt := SUBSTR
                   (
                        c_txt,
                        1,
                        return_max_val - LENGTH (return_txt)
                   );
              END IF;
    
              return_txt := return_txt || c_txt;
    
              IF  LENGTH (return_txt) >= return_max_val
              THEN
                   EXIT;
              END IF;
    
              row_cnt := row_cnt + 1;
         END LOOP;
         CLOSE in_cursor;
    
         RETURN (return_txt);
    END  concat_query
    ;
    
    END     string_agg;
    /
    SHOW ERRORS
    

    Here is an example of a specific function using this package:

    CREATE OR REPLACE FUNCTION all_years
    (
         in_item_no          IN     item_year.item_no%TYPE
    )
    RETURN     VARCHAR2
    IS
         q_cursor     string_agg.concat_query_cursor_type;
         return_txt     VARCHAR2 (4000);
    BEGIN
         OPEN       q_cursor     FOR
         SELECT       year
         FROM       item_year
         WHERE       item_no     = in_item_no
         ORDER BY  year;
    
         return_txt := string_agg.concat_query
         (
              q_cursor,
              ', '
         );
    
         RETURN (return_txt);
    END  all_years;
    /
    SHOW ERRORS
    

    The all_years above is a stand-alone function. You could also just have a function in a package, or string_agg, or another package, if that suits your needs.
    As you can see, the specific function is quite trivial. You could probably do something with dyanamic SQL, where you write another function, with the text of a query as a string argument, and it calls concat_query and returns this value.

    Here is an example of using the all_years function in a query:

    SELECT     item_no
    ,     all_years (item_no)     AS years
    FROM     (
             SELECT DISTINCT  item_no
             FROM             item_year
         )
    ;
    

    You could SELECT DISTINCT in the main query, but it would be less effective.
    Output:

    ITEM_NO                   YEARS
    ------------------------- ----------------------------------------
    item1                     1998, 2002, 2003, 2004
    item2                     1984, 1991, 2006, 2008, 2010
    
  • Cannot select several items for download in Win7 dialog box

    Hello. You try to download several PDF elements to merge here: http://foxyutils.com/mergepdf/
    Should work 'normally' - control click to select more than one. I have used the site before, but now you have a fresh user account as the last of them has been installed properly (but I had FF and he worked as far as I KNOW).

    FF 37.0.1 on Win7 Enterprise ghostery & adblockplus off, java temporarily the value 'always allow', set of java dev 'request' (cannot change).

    Any thoughts anyone? Seems very strange. Don't know if it's a Windows problem; I can select several elements with control + click in windows Explorer...

    By chance you have to update your flash player?

  • Select several batches to post

    In the query logs window, how to select multiple lines to publish?

    s.png

    Thank you

    Hello

    I thin it is not possible to select several lines of page "enter in magazines."

    You can post multiple journals using either:

    1. the form of 'Post' (General Ledger resp. > journals > Post) for query logs and select the journals you want to display and press the message button.

    2. using the automatic validation program (concurrent request) and determine the set of automatic recognition criteria. You can set an automatic validation of the criteria (General Ledger Manager > Setup > Journal > AutoPost)

    Hope this helps,

    Please mark responds 'Proper' or 'Useful', as appropriate, to facilitate solutions to the other participants in the community

  • Pass selected option to a function

    Hi all

    I have a form with an option > etc..., select > <.  The form works fine, but I was not able to pass the value of the option selected to a function that will generate an alert pop-up windows.  Within the function, I want to test the selected option and if you have selected one or more specific options, then generate the alert popup.

    In my form:

    < select name = "mbr_scat" id = "mbr_scat" onchange = "mbrdecdwarn('mbr_scat')" >

    <? PHP $scat_select = ""; If ($nmbr_row [2] == "") {$scat_select = "selected" ;}? >

    < option value = '0' <? PHP echo $scat_select;? > > * select * < / option >

    <? PHP $scat_select = ""; If ($nmbr_row [2] == 'P') {$scat_select = "selected" ;}? >

    < option value = 'P' <? PHP echo $scat_select;? > > dues payer < / option >

    <? PHP $scat_select = ""; If ($nmbr_row [2] == 'L') {$scat_select = "selected" ;}? >

    < option value = 'L' <? PHP echo $scat_select;? > > life member < / option >

    <? PHP $scat_select = ""; If ($nmbr_row [2] == 'H') {$scat_select = "selected" ;}? >

    < option value = 'H' <? PHP echo $scat_select;? > > honorary < / option >

    <? PHP $scat_select = ""; If ($nmbr_row [2] == "S") {$scat_select = "selected" ;}? >

    < option value = "S" <? PHP echo $scat_select;? > > special < / option >

    <? PHP $scat_select = ""; If ($nmbr_row [2] == "D") {$scat_select = "selected" ;}? >

    < option value = "D" <? PHP echo $scat_select;? > > deceased < / option >

    < / select >

    function mbrdecdwarn ($mbr_scat) {}

    If ($mbr_scat == "D") {}

    Alert ("deceased warning");

    } else {}

    D1 = $mbr_scat;

    Alert (D1);

    }}

    When I run the page code above and select one of the options, the - mbr_scat - words are displayed in the pop-up window.

    When I remove the single quotes around mbr_scat, I get - [objectHTMLSelectElement] - in the context menu.

    Using many variations, I never got the real part of the if statement in the function to work.

    What Miss me?

    Any guidance genuinely appreciated and as always, thanks in advance.

    Tom

    Hi, Tom.

    You don't need to move from a selected option value or text to a function in order for the text or value in javascript. JavaScript can get the value of the selected option or text to the way to getElementById and the text of selectedIndex (or value) of the item, as shown in the example below.

    
    
    
    
    
    
    
    
    

    best,

    Shocker

Maybe you are looking for