Extraction of multiple values

Hi all

I have three tables A, B, C. The query is like that

SELECT A.TL, (by SELECTING A.AID, A.ff IN A, B, C
WHERE A.FN = 'PA'
AND A.AID = B.AID
And B.code = '01'
AND B.PID = 'B001'
AND B.CID = C.CID
AND C.CID = 'T001') OF A, B, C
WHERE A.FN =' IT
AND A.AID = B.AID
And B.code = '01'
AND B.PID = 'B001'
AND B.CID = C.CID
AND C.CID = 'T001'

Whenevr I execute this query, I get an error message because the inner query is pulling two values which is does not match outerqueries. If someone can guide on it.

Thank you
HRS

Enter this thread as answered and open a new one in the sql forum:
SQL and PL/SQL

Here you get a faster response.

Thank you

Tags: Database

Similar Questions

  • Another REGEXP question: how to extract multiple values from a string

    Hi, how can I retrieve multiple values to a string with RegExp with Oracle SQL constructs?

    Have looked at the various examples, I cannot understand this.
    the following Sql code
    select
       regexp_substr(sessie."rollen", 'CN=A_role') "A_role"
       from ( 
    select '
    CN=A_role,OU=a_org_unit,OU=another_org_unit,DC=bz,DC=ad,DC=min,DC=local
    CN=Another_role,OU=some_org_unit,DC=bz,DC=ad,DC=min,DC=local
    CN=Users,OU=Dep,DC=bz,DC=ad,DC=min,DC=local
    '   "rollen" from dual
    ) sessie;
    Returns CN = A_role.
    I want him back all of the CN = concatenated values with a semicolon and stripped of the CN = bit.
    So: A_role; Another_role; Users .

    Any help would be much appreciated. Here I use database 11g 11.2.0.2.0.

    Does anyone have an idea how to do this in SQL?

    best regards Mike

    Hello
    If using Oracle 11 g

    with tst
      as (select   'CN=A_role,OU=a_org_unit,OU=another_org_unit,DC=bz,DC=ad,DC=min,DC=local,'
                 ||'CN=Another_role,OU=some_org_unit,DC=bz,DC=ad,DC=min,DC=local,'
                 ||'CN=Users,OU=Dep,DC=bz,DC=ad,DC=min,DC=local' as rollen
            from dual
          )
    select listagg(sub, ',') within group (order by rn) as res
      from (select regexp_substr(rollen, '(CN=)([[:alnum:]_]+)',1,rownum,'i',2) sub, rownum rn
              from tst
           connect by level <=length(rollen)
           )
     where sub is not null       
    
  • Search for multiple values in a single field

    Hello

    I have this request to get results when the user doing a search query:

    select * from (
    select 
    "ID",
    "ID" ID_DISPLAY,
    "SHIFT_DATE",
    "SHIFT",
    "OFFENSE_ID",
    "DESCRIPTION",
    "ANALYST",
    "STATUS",
    "SUBSTATUS"
    from "#OWNER#"."IDSIEM_OFFENSES") 
    where
    OFFENSE_ID IN(:P223_OFFENSES) AND
    
     (
     instr(upper("DESCRIPTION"),upper(nvl(:P223_DESCRIPTION,"DESCRIPTION"))) > 0 
    )
    AND
    (
     instr(upper("SHIFT"),upper(nvl(:P223_SHIFT,"SHIFT"))) > 0 
    )
    AND
    (
     instr(upper("SUBSTATUS"),upper(nvl(:P223_SUBSTATUS,"SUBSTATUS"))) > 0 
    )
    AND
    (
     instr(upper("ANALYST"),upper(nvl(:P223_ANALYST,"ANALYST"))) > 0 
    )
    AND
    (
     instr(upper("SHIFT_DATE"),upper(nvl(:P223_SHIFTDATE,"SHIFT_DATE"))) > 0 
    )
    AND
    (
     instr(upper("STATUS"),upper(nvl(:P223_STATUS,"STATUS"))) > 0 
    )
    
    ORDER BY OFFENSE_ID DESC
    

    The thing I want to do is to set multiple values in the P223_OFFENSES field when I search. For example, an offence is a number, so I want to put in the search box 1111, 3333, 4444, 5555 and the report shows me these 4 offences in the report. The search operation only works when I put only 1 offences, but when I put more than 1, separated by commas, it gives me this error: error report: ORA-01722: invalid number. That is why, because is a number and the character point is not allowed, how can I achieve this? Thank you in advance.

    Best regards, Bernardo

    I solved a problem like this a few times with a utility function of pipeline for extracting the values from the list:

    CREATE or REPLACE TYPE split_tbl AS TABLE OF VARCHAR2 (32767).

    /

    FUNCTION to CREATE or REPLACE split_list

    (

    p_list VARCHAR2

    p_delimiter VARCHAR2: = ', '.

    ) Split_tbl RETURN

    PIPELINED IS

    l_idx PLS_INTEGER;

    l_list VARCHAR2 (32767): = p_list;

    BEGIN

    LOOP

    l_idx: = instr (l_list, p_delimiter);

    IF l_idx > 0

    THEN

    LINE of CONDUCT (substr (l_list, 1, l_idx - 1));

    l_list: = substr (l_list, l_idx + length (p_delimiter));

    ELSIF TRIM (l_list) IS NOT NULL

    THEN

    PIPE ROW (l_list);

    EXIT;

    ON THE OTHER

    EXIT;

    END IF;

    END LOOP;

    RETURN;

    END split_list;

    /

    In this way, you can define SQL like:

    SELECT to_number (column_value) FROM TABLE (split_list (' 1, 3, 99', ','))

    Or for this specific case: replace the condition

    OFFENSE_ID IN(:P223_OFFENSES)

    with

    OFFENSE_ID IN (SELECT to_number (column_value) FROM TABLE (split_list (: P223_OFFENSES, ',')))

    The advantage over using instr or regex is that you can usually always benefit index on OFFENSE_ID

    Better also to restrict entry to only numbers and ', ' or you will always get invalid numbers errors if a user enters "1234, 567, ABC"in the field of P233_OFFENSES.

    Kind regards

    Thierry

  • How to select multiple values in a single field.

    Hi all

    I once select stmt as below

    ==================================

    SELECT msi.segment1,
    IN l_chr_omc_item
    OF SGM_INV_ITEM_ATTRIBUTES SIIA, msi mtl_system_items
    WHERE msi.inventory_item_id = siia.inventory_item_id
    AND siia.attribute12 = l_chr_tsb_item;

    ======================================

    I need to print some l_chr_omc_item, but if the above query retrieves multiple values of the l_chr_omc_item for a l_chr_tsb_item so I need to print all the values. How to get all these values in a single rank.
    Thanks in advance.

    Published by: Shivaji M on June 28, 2009 23:18

    Published by: Shivaji M on June 28, 2009 23:27

    cursor curGetxx (inpl_chr_tsb_item in SGM_INV_ITEM_ATTRIBUTES.attribute12%type)
    is
    SELECT
    MSI. Segment1
    Of
    SGM_INV_ITEM_ATTRIBUTES SIIA
    msi mtl_system_items
    WHERE msi.inventory_item_id = siia.inventory_item_id
    AND siia.attribute12 = inpl_chr_tsb_item;

    l_chr_omc_item SGM_INV_ITEM_ATTRIBUTES.attribute12%type;
    vStrl_chr_omc_item varchar (500);

    Start
    Open curGetxx (l_chr_tsb_item);
    loop
    extract the curGetxx in l_chr_omc_item;
    When the output curGetxx % NOTFOUND;
    vStrl_chr_omc_item: = concat (l_chr_omc_item, ',')
    dbms_output.put_line (l_chr_omc_item);
    end loop;
    vStrl_chr_omc_item: = substr (vStrl_chr_omc_item, 1, length (vStrl_chr_omc_item)-1);
    end;
    /

  • How to url using NOT IN (NIN) IR filter for multiple values?

    Apex 5.0.1 (but should work for Apex 4.2)

    I want to set a url with an IR filter using the filter NOT IN. For example, to get a filter that says: status not in (3,4)

    To do this, we can use the url IRNIN_STATUS parameter.

    This method works. Problem is how can I set multiple values in the url?

    IRNIN_STATUS:3, 4 will give a filter 'status not in (3) '

    4 is interpreted as the following for the next parameter value, even if there is no additional parameters.

    Find / remember the solution:

    We can add the backslashes to values to distinguish them from others.

    IRNIN_STATUS:\3, 4

  • Multiple values in a single Table cell

    Hello

    I have a requirement of the customer. I need to show multiple values within a table cell

    Example of

    Location City Shop
    NorthCity AHS-200, SH-210, SH310
    SouthCity BSH - 100, SH341
    EastCity CSH-20

    But my table shows repeating cell as follows.

    Location City Shop
    NorthCity ASH-200
    NorthCity ASH-210
    NorthCity ASH310
    SouthCity BSH-100
    SouthCity BSH341
    EastCity CSH-20

    So I need your help to show repeated STORE name in a single column of the Table.

    Thank you

    Try this

    EVALUATE_AGGR ('LISTAGG (%1, %2) within THE GROUP (ORDER BY DESC %3)', TableName.ColumnName, ',', TableName.ColumnName)

  • Extract only 2nd value

    Hello

    I want to extract only 2nd value of col2 that holds the values of semicolons.

    When I try his failure to appear as expected.

    Table

    col1 col2

    ------    ----------

    A cod; MOD; KL

    B; DF

    C ss; 6; 7

    D gg

    Expected results:

    col1 col2

    ------          ----------

    A mod

    B               df

    C

    D

    My test:

    with

    a trial in

    (select 'A' col1, col2 "cod;) MOD; KL' Union double all the

    Select 'B ', '; '. df"of the double

    Union of all the

    Select 'C', "ss; 6; 7' of the double

    Union of all the

    Select would be ', 'gg' of the double

    )

    Select col1,

    NULLIF (regexp_substr (NVL(col2,'~'), "[^;]")) +', 1, 1),'~ ') col2

    of the test;

    I get:

    col1 col2

    ------          ----------

    A mod

    B               df

    C               ss

    D               gg

    Any help will be appreciated.

    Thank you

    Hello

    You can also use regular expressions to get the N-th section, like this

    REGEXP_SUBSTR (col2

    , '([^;] *)(;|$)'

    1

    N - whole, to 1 or greater

    NULL

    1

    )

    SUBSTR and INSTR will be faster, however.

  • What subprogramme should we prefer to return multiple values with OUT parameter?

    Hello

    I worked on the procedures and functions, and aware of their differences. Today I have an interview question that - suppose I don't have return multiple values through a subroutine and I want nor run any what DML within this subprogramme and I want to use this subprogramme in the SQL query. What subprogramme I would prefer - "Operating Mode" or "Function" and why?

    In my view, both can be used in this case, but want to see your views and opinions.

    Kind regards

    Sachin jerbi

    In terms of software engineering, if you claim something that you expect to "return" something (a value or values) then you use a function.  If you call something to "do" something, and then you use a procedure.

    THE settings are not good practices in many cases and should not strictly considered "return" of values.  Instead, they are assigned values in the code and generally act as pointers to the original variable/structure that was passed as a parameter (the actual internals of Oracle don't quite do it, but in principle this is what they do).

    A return value (or structure) of a function is basically push in the battery to the point that the RETURN statement is issued, and then the code calling the stack appears to assign it to a variable or placeholder, it should go in.

    If it seems a little difference between procedures and functions to some people, it is recommended to use functions for obtaining values and procedures to do things, in most cases.  It is not just "syntactic sugar", as mentioned above.

  • Plugin to point that returns multiple values

    When you create an APEX element that can return multiple values, such as a checkbox, APEX uses the settings of varchar2 p_v01 - p_v200 instead of the p_t01 table settings - p_t200.

    I would like to create a plugin item type that can return multiple values in the same way, so that the session recorded for the item state contains a delimited string of values.  I realize, I could achieve with Javascript and a hidden item, but I really want to a non-Javascript solution.  Is this possible?  If this isn't the case, it would be a nice improvement!

    Hi Tony,.

    Take a look at the level of the parameter p_is_multi_value of the APEX_PLUGIN. GET_INPUT_NAME_FOR_PAGE_ITEM api (http://docs.oracle.com/cd/E37097_01/doc.42/e35127/apex_plugin.htm#AEAPI1254). If you set it to TRUE, you will get one of the p_v01 - p_v200 table settings. It's the same what our box element type calls.

    Concerning

    Patrick

    Member of the APEX development team

    My Blog: http://www.inside-oracle-apex.com

    APEX Plug-Ins: http://apex.oracle.com/plugins

    Twitter: http://www.twitter.com/patrickwolf

  • Multiple values in the dashboard application application database Direct

    Hello

    I created a direct request from the database that accepts input from a prompt by a variable of presentation, either placed in request of db query. I realized in the process that I had to give a default input to the variable of the presentation of the petition. The input variables passed from the dashboard quick came in the right format, only if they are placed in quotation marks, Eg: "Input_Var".

    After all this, I came across a problem when multiple values are entered, the query is generated with an incorrect format. Here is the example:

    Select col1, col2

    of TabXX

    where username IN "Acct_Nm1", "Acct_Nm2"; ')}

    Is there anyway to solve this problem. Thanks in advance.

    Hi all

    I used the sequence next to convert the string separated by commas, received XML from the dash prompt.

    "Select XXX".

    movies XXX

    where the value

    in (SELECT )

    EXCERPT (VALUE (d), ' / / row/text () ") .getstringval)

    Of

    (SELECT XMLTYPE ('' |)) REPLACE ('VALUEOF (NQ_SESSION.req_var)', ';', ''). ') AS xmlval

    The DOUBLE) x,.

    ( TABLE (XMLSEQUENCE (EXTRAIT (x.xmlval, '/ lignes/ligne'))) d)"

    Create a query variable 'req_var' in the prompt to serve in "VALUEOF (NQ_SESSION.req_var)" and pass it to the report. It will be useful.

    Thank you.

  • Passing multiple values at the request of the State (no status page)

    Hello

    [APEX 4.2.4.00.08 on the 11.2.0.3 database]

    I didn't know how to explain briefly what I need in the title of the discussion, that's why I added the song "(non page rapport)". "  I met a lot of threads associated with passing of selections multiple values from one page to another, or via a URL from one page to another.  I know how to do this.  The problem I have right now is trying to pass the commas of the values contained in an application to a report query element.  Here's where the "(rapport non page) ' comes into play."  I refer to the report query at the level of the application (i.e. shared components-> report queries).  I wish really it had another name for it.  "Report on the application of queries", perhaps?

    In any case, my report query has a bind variable, AI_ID_NUMBERS, that is defined correctly in the shared-> components report queries. However, when this item application has multiple values such that AI_ID_NUMBERS = 4, 5, 6, 7 etc., my URL looks like this:

    myapexsite.com/f? p = 456:2:1234567890:PRINT_REPORT = report_1:AI_ID_NUMBERS:4, 5, 6, 7

    So, this returns only one record for the report where the identification number is 4, one.  I tried a string parameter of Substitution of Application (URL_REPORT_1) with the two following variants (for which both return only a single record):

    Substitution string = URL_REPORT_1 and Substitution value = f? p = & APP_ID.:0 : & SESSION. : PRINT_REPORT = report_1:AI_ID_NUMBERS: & AI_ID_NUMBERS.

    Substitution string = URL_REPORT_1 and Substitution value = f? p = & APP_ID.:0 : & SESSION. : PRINT_REPORT = report_1:AI_ID_NUMBERS:-& AI_ID_NUMBERS. \

    returns...

    myapexsite.com/f? p = 456:2:1234567890:PRINT_REPORT = report_1:AI_ID_NUMBERS:4, 5, 6, 7

    myapexsite.com/f?p=456:2:1234567890:PRINT_REPORT=report_1:::AI_ID_NUMBERS:\4,5,6,7\

    .. .respectively

    I really thought that the backslashes would have solved the problem.  Any ideas why my report request (PDF) returns only one line?

    Thank you

    -Seth.

    Well, too bad. I realized the mistake I did.

    When you work with 'request report queries', there is an option to include variable bind, for example the application or page elements.  I had already done that, but for some reason, thought that I also had to pass the parameter and its values in the URL.  This is not necessary since the report query query already has the issue of the application/page related to it.  The following URL works fine:

    myapexsite.com/f? p = 456:2:1234567890:PRINT_REPORT = report_1

    And, Yes, it's the URL that is provided when you set up a "application report query.  I was thinking too hard.

    -Seth.

  • ERROR: The specified parameter 'Rental' expects a single value, but your name criteria "PROD" corresponds to multiple values.

    Hello

    I am writing a script to create the new VM (base clone of a virtual machine) in a specific folder.

    When you run the script, I get an error:

    The specified parameter 'Rental' expects a single value, but your name criteria "PROD" corresponds to multiple values.

    Some research led me to a post of 2011, which describes the same error. The only thing is, I can find no trace of open connection and then a more...

    What I tried:

    I run the script on the server for vSphere, so I closed the open vSphere client.

    closing ('disconnect-viserver") all existing connections in the first line of the script-> an error because no connection is open.

    In several places in the script, add the following lines:

    ECHO ' - '.

    $DefaultVIServers <-as noted in the post of 2011

    ECHO ' - '.

    This shows that no connection is open until I do the "connect-viserver", subsequently, apparently, that a connection is established.

    the results and the (current) script are found in the files to attach.

    I also found an error on the "set-PowerCLIConfiguration that I can't explain.

    One last question... Is there a possibility to have the new virtual machine created through 3 hosts? the first on the first host, the second on the second, the third on the third, the fourth back on the first host,... and so on?

    Any help would be appreciated.

    Thank you.

    Johan

    Of course, you can provide the full path, for example see my post of folder by Path .

  • VSM 9.1.4 multiple values updated select via API

    Hi all

    We use a lot the VSM (9.1.4) Web service API in our Interfaces. The standard fields and 'normal' extension of work.

    Now have the obligation to insert/update a list to multiple values of selection via the api.

    As he is only mentioned anything that in the Guide of the API we tried and add several entries with the same ext_fldv to the [of CustomParamData].

    No error is thrown, but it only takes the last entry for this ext_fldv the table int.


    Has anyone of you updated a multivalued field to select via the api?


    Any suspicion on this would be be appreciated.

    ... and Yes, several values must be provided in a comma-separated string. In the example:

    Dim _ws_cust_data_list As New List (Of CustomParamData)

    _ws_cust_data_list. Add (New CustomParamData ("EXTFLDV_500102", "105,107,108"))

    Var _ws_cust_data_array() As CustomParamData = _ws_cust_data_list. ToArray()

    _ws_rq.aCustomParameters = _ws_cust_data_array



  • 3.1 assignment multiple value formatting

    I use "|" as my multiple assign delimiter. In my chart LoadData, merge multiple values using that delimiter. I have the code in a loop like this:

    ResourceInfo ResourceInfo = + ' | '.

    In my bulk loading, I set the delimiter to assign several ' |. '  In 3.0, when I show this multiple assign field in a results list, each value is separated by a line break, like this:

    Project resources: Karen James-Project Worker

    Ryan Bookout-project worker

    Steven Davis-project worker

    But to the point 3.1, each value is separated by a comma with no line breaks, like this:

    Project resources: Karen James-project worker, Ryan Bookout-project worker, Steven Davis-project worker

    Is there a way of 3.1 having set several values are displayed with a power line as it did in 3.0?

    I found how to display multiple values on individual lines (rather than strung separated by a semicolon or a comma). In the Studio, when you added a field multi - attribute to the list of results, change the attribute, open the display options, and for values multiple display select "individual lines. I did not notice this option before.

  • The research of Web applications with fields of the Data Source that contains multiple values

    I have a Web application with a field that allows multiple values to be recorded similar to the list box. I need limit the allowed values for a large, over the list of the values currently stored in another Web application as a data source. I can not apply to the type of Data Source field that allows only single value selection. I also need to be able to use the search form Web App to search for items containing 1 OR more of the values in this field (a type of list control field search functionality). Here's what I tried to field types:

    • Text (String) or text (multi-line) field type - By saving a list of values separated by commas (outputs in the same way this list box) to an entry of text or textarea, the search only logic search exact string (including commas) and does not analyze individual values.
    • Type of list (checkbox) field - it allows me to search for multiple values using the logic of the GOLD, but the web application stores only the values that have been entered as an option in the field settings real web app. I tried to use a checkbox with minimal or empty options list, hoping that some values I sent more separate by a comma value chain would be still stored, but because the values come from my Web App data source and not stored with the field options list, they were not saved.

    Someone at - he found a way to do it?

    My other question is how can I use a multivalued field to similar as described above but return results containing the elements with ALL the values of this field (AND logic).

    Can someone enlighten me to the inner workings of the search BC logic web app?

    You don't need to use the predefined boxes or types of entries. Everything you can represent as a string (such as the values separated by commas in your example) can be saved in any field of webapp. The types of fields defined in the Web application are only used to translate internal representation (all channels) to the various user-friendly interpretations (checkboxes, radios, dates, links, etc.)

Maybe you are looking for

  • Paper art are grayed out

    Hello world Any setting I try, I can't select Pages fine art papers. I select manual back, before art, black etc Matt, there is always grey I have re set the printer pane, upgraded to El Capitan, purchased and installed an Epson P800 The same problem

  • I want to delete an inactive Apple account

    I have an I phone and a laptop asking yet old Apple ID. I have more access to the electronic ID/mail old, and it is inactive. I have another valid Apple id, but keep getting requests for the old id

  • With ios 9.2 no way to contact groups?

    Is there still no way to get in touch with ios groups 9, with using 3rd party applications?

  • no active controls on the front after sub vi opens

    Hello I have a little difficulty with my VI. I run a sub my main façade of VI VI. The sub VI opens, but when it is closed all of the controls on the front of my main VI is no longer active (buttons etc. not clickable). I put counters on the iteration

  • USB 6008 DI sampling frequency

    Hello I would like samples N to a digital input on 6008 channel. In the port of GOT it, it is possible to put samples/channel and sampling frequency, but I couldn't find a way to do the same for the channel of DI. If I use MAX to read the N samples o