When the clause with conditions

Hi all

I have a report that must be filtered according to user input in a field of text and drop-down list.
The goal is to let the user enter either an exact value (based on the AutoComplete feature) or use the wildcard character %

It is where comes the menu drop down. If they choose value1, AutoComplete, the exact value is used and the where clause would look like something below,
select col1, col2, col3
from table
where :P1_FILTER in (select distinct col2 from another_table)
If they choose value2, then where should deal with using the same function and % s. something like:
select col1, col2, col3
from table
where :P1_FILTER like (select distinct col2 from another_table)
How can I take care of this in 1 where clause? I'm kind of stuck trying to figure out.
Thanks for any help.

-Chris

Try this:

select col1, col2, col3
from table
where
(
:P1_FILTER in (select distinct col2 from another_table)
AND
:P1_LOV =1
)
OR
(
 :P1_FILTER like (select distinct col2 from another_table)
AND
:P1_LOV =2
)

I hope this helps!
Sam

Tags: Database

Similar Questions

  • Is there a work around to show the Site identity button when the integration with facebook like/send etc. It disappears when it comes to the page, it's because of the iframe can be done if anything.

    Is there a work around to show the Site identity button when the integration with facebook like/send etc. It disappears when it comes to the page, it's because of the iframe

    What can be done if anything.

    Pages that use "mixed content" (parts of the use of the HTTP page and some use HTTPS) are not secure against tampering, they will not display the site identity button. To resolve this problem, make sure that external resources you are incorporation are available over HTTPS and you use HTTPS to nest them.

    For example, to iframe widgets like the Facebook 'Like' buttons, make sure that your iframe use src = "https://192.168.1.20 /...". »

    See also discussion here: http://stackoverflow.com/questions/3587021/facebook-like-button-breaks-https-ssl

  • How to use the clause type conditionally create new lines

    This question is just for learning - no object other than to start real world to create versions of some queries known to learn how to measure the performance of the MODEL clause clause of the MODEL versions.

    The question is: How can you write a STANDARD clause that pivots (updates) ONLY the lines that actually need to rotate and do NOT change the lines that have no value and cannot be rotated.

    I found a good site that has about two dozen example articles on different pieces. This first link is the beginning of the series.

    SQL features tutorials - Clause TYPE

    http://www.sqlsnippets.com/en/topic-11663.html

    This link is to a clause of FAQ of BluShadow MODEL version "how to convert rows to columns."

    Line - MODEL method string

    http://www.sqlsnippets.com/en/topic-11987.html

    The solution to this link uses this line of source:

    POSITION KEY VAL

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

    R08 0 v1, v2, v3,.

    and this result set:

    POSITION KEY VAL

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

    R08 1 v1

    R08 2 v2

    R08 3 v3

    The reason why it produces that result set is this clause of the statement of MODEL

    RETURN THE UPDATED LINES

    If you comment on this article, you will see that the original lines are all in position 0. This means that the solution reproduced EACH SOURCE LINE even if there is only one item in the list of values.

    Thus, even a line source with a single value (for example, the r01 'a') will be updated and updated this line is returned.

    For a large number of data sources with only a few lines that actually need to rotate it would be a great performance of infringement.

    This is the sample data source

    with t as (button 1, 'a' value 'abc' col2, col3 'def' of the double
    Select Union all 2, 'b', 'ghi', 'jkl' from dual
    Union all select 3, 'c, d, e, 'mno', 'pqr' from dual.
    Union all select 4, 'f', 'stu', 'vwx' from dual
    )
    Select the key, value, col2, col3
    t

    KEY, VALUE, COL2, COL3
    1, a, abc, def
    2, b, GHI, jkl
    3, "c, d, e, mno, pqr.
    4, f, stu, vwx

    Lines 1, 2 and 4 only have a value of (a, b, c respectively.

    Only line 3 must rotate. It contains "c, d, e" and which must become 3 lines in the result set

    Value of the key, col2 col3
    1 an abc def
    2B ghi jkl
    3 c mno, pqr
    3 d mno, pqr
    3 e mno, pqr
    4 f stu vwx

    The nut of the problem is that if the clause 'RETURN UPDATED ROWS' is used, then the lines 1, 2 and 4 must be updated in order to be returned in the result set. And if this clause is NOT used, then line 3 must be updated by 'c', d, e 'c' and two new product lines: one line for a ' and one for 'e '.

    How can you do this with the TYPE clause without the help of the clause "Return LINES UPDATE"? I don't have a solution to sample showing what I tried because I can't understand what it takes to even try.

    I have a solution that uses "RETURN UPDATED ROWS" but I want to compare this performance to the exercise, when this clause is NOT used.

    We ask BluShadow to add the solution of MODEL clause to this FAQ with other similar solutions.

    Like this?

    SQL > with t as
    () 2
    3 select the 1 key, 'a' val, 'abc' col2, col3 'def' of the double


    Select 4 Union all 2, 'b', 'ghi', 'jkl' from dual
    5 union all select 3, 'c, d, e, 'mno', 'pqr' from dual.
    Select 6 Union all the 4 'f', 'stu', 'vwx' from dual
    7)
    8. Select the key
    9, key_1
    10, val
    11, regexp_substr (val, ' [^,] +', 1, key_1) val_new
    12, col2
    13, col3
    14 t
    model 15
    16 partition by (key)
    dimension (1 key_1) 17
    18 measures (val, col2, col3, (length (val) - length (replace (val, ",")) + 1) as len)
    19 rules
    (20)
    21 val [for 1 to increment of len key_1 [1] 1] = val [1]
    22, col2 [for 1 to increment of len key_1 [1] 1] = col2 [1]
    23, col3 [for 1 to increment of len key_1 [1] 1] = col3 [1]
    24)
    25 order
    26 by key
    27, key_1;

    KEY KEY_1 VAL VAL_N NECK NECK
    ---------- ---------- ----- ----- --- ---
    1 1 has an abc def
    2 b 1 b ghi jkl
    3 1 c, d, e c mno pqr
    3 2 c, d, e d mno pqr
    3 3 c, d, e e mno pqr
    4 1 f f stu vwx

    6 selected lines.

  • BlackBerry Smartphones BlackBerry keeps beeping all the time - just beeps when the connection with the carrier is active.

    Gentlemen.

    I have a Curve 8900 with the 4.6.1.133 (Platform 4.2.0.85).

    This unit maintains a beep every 10 seconds, I tried to remove the battery when the BB was on, wait a minute, put it again.

    I looked at all the configurations.

    I Don t no the slightest idea and wanted to throw it in the window.

    Any ideas? Advice?

    NEW INFORMATION. The device stores only beep if the wireless connection with the carrier is active. If it s off the beeps stops. I m using Claro to the Brazil.

    Camilo

    I found the solution. This is a bug beetween the network operator's SIM card software and the BlackBerry device. It s already solved. I had to follow certain steps to enable and disable a specific feature of the network operator and wait a dialog box confirm my operation.

    The beeps comes with the dialog box, but the apears only dialog box if you are in a specific screen of the blackberry. If you are in the home screen, it will not appear and you hear the beep.

    Camilo

  • How to get to 'leave the event' script to run again when the form with the data file is reopened?

    I've created an Adobe Dynamic XML using LiveCycle Designer form with many fields / subforms that are 'visible' or the 'hidden' according to the selected options of different menu drop-down lists. Also, the form has been activated to save. Users can successfully fill out the form and save a copy with the data that has been entered.

    The problem I have is that when the recorded file is opened again in the 'hidden' fields / subforms that were previously made visible by selecting the appropriate options in the drop-down list NOT displayed now. However if you make the same selections from each of the drop-down list shows still hidden ONCE the fields / subforms are displayed, and do not contain data that has been entered.

    The problem seems to be that the script that determines whether a field / subform is 'hidden' or 'visible' is a

    "<event activity="output" name="event__exit">" "

    that is followed by

    If (this.rawValue is '0')- (i.e. the value of the drop-down list)

    sfCompanyDetails.presence = "visible";

    sfRecruitmentAgency.presence = 'hidden ';

    etc, etc.

    and, therefore, it is not executed again when the file is reopened.

    Can someone advise please how do I do this?

    Hello

    Check if you enabled the "auto" option to keep the script changes in the properties of the form.

  • Calculation of the sum with condition

    Hello
    I start with BI publisher, and I want to take a NAP with condition.

    My report output XLS, I haves columns, named ACCOUNT_TYPE and TREE_NODE and MOENTARY_AMOUNT_03 that are my PS query fields

    I want to sum only when a condition is true.

    <? xdofx:If ACCOUNT_TYPE = 'R' AND TREE_NOD = 'TEST' then
    Sum (MONETARY_AMOUNT_03)
    end if? >

    This does not,
    could you help me?

    thaks!

    You should do this:

  • If clause with condition of property element

    Hello

    I'm new to the world of the oracle. I would like to know if we can do something like below in oracle.

    We can define if condition in timer in VB as below.

    Private Sub Timer1_Timer () - timer with interval 1000

    If Text1. BackColor = red then
    Text1. BackColor = white
    otherwise if Text1. BackColor = white then
    Text1. BackColor = Red

    end if

    End Sub


    HW convert this to oracle as it should use the set_property function to change the item property in oracle. hope someone can answer...

    Hello

    Try the following code in the trigger WHEN-CLOCK-arrival at EXPIRATION .

         IF GET_ITEM_PROPERTY('.', BACKGROUND_COLOR) = 'r255g0b0' THEN  -- RED
              SET_ITEM_PROPERTY('.', BACKGROUND_COLOR, 'r0g255b00'); -- GREEN
         ELSE
              SET_ITEM_PROPERTY('.', BACKGROUND_COLOR, 'r255G0B0');
         END IF;
    

    Kind regards

    Manu.

    If my response or response from another person was helpful, please mark accordingly

  • Siri &amp; command voice crazy when the execution with headphones

    Everyone knows a combination of Siri (and after I disabled Siri) then the voice command goes a bit out of whack? This happens when I'm out of the race, I have my iPhone 6plus in an armband and I use generally a few apps (Strava & MapMyRun) running and listening to music. I say try because recently Siri turned without my activation. I have disable Siri and then on another race and unusable voice control music playback. Effect, apart from the interruption of playback of music, had to skip songs, fast forward and usually impossible music.

    Initially I thought he could have my cuff by pressing the buttons somehow, but after a few tries I excluded only. I guess it must be something to do with the helmet, but does not know which affected them has an effect on this problem. They used to work properly.

    Thought I'd share a few comments. The fault was with the helmet. Must have been faulty wiring or a certain type of damage that has been feeding via the headphones and sending crazy Siri. A new pair of headphones did the trick, and once again I can listen to my music while on the race. I deliberately chose headset without a microphone this time. After all, I'm not really taking a call when I'm blowing and blowing on a race and I hope that can mean this pair last longer.

    Also, tip practice, might be useful to check the headphone jack for an accumulation of lint. I used a stick to fish out debris.

  • Dynamic action - when the 'event' and 'condition' seems to have no sense

    Step by step, I am trying to get free Javascript coding so I can rely on what natively offers the Apex. It was an interesting experience, however I have noticed certain situations sicesdonneessontdisponibles options seems to have no sense, at least to date, and you will certainly help me which can be cleared up. I tried to put one of them into words. I just created a new dynamic action that will just set the focus to an element whenever my page is loaded.

    Why my new dynamic action allows me to choose the "Page loading" event and condition "sucks"? I don't understand why this combination is available. There is probably no effect anyway, but I decided to leave the condition "without condition."

    Thanks in advance.

    Franklin.Jr wrote:

    Step by step, I am trying to get free Javascript coding so I can rely on what natively offers the Apex. It was an interesting experience, however I have noticed certain situations sicesdonneessontdisponibles options seems to have no sense, at least to date, and you will certainly help me which can be cleared up. I tried to put one of them into words. I just created a new dynamic action that will just set the focus to an element whenever my page is loaded.

    Why my new dynamic action allows me to choose the "Page loading" event and condition "sucks"? I don't understand why this combination is available. There is probably no effect anyway, but I decided to leave the condition "without condition."

    It's just that there is a basic LOV status of one size for all types of events. Most of the conditions it contains is relevant to events associated with the elements. "Page Load" + "sucks" doesn't in fact make sense, but 'P4_END_DATE' + 'is null' fact. The Condition property remains visible and active so that the option "JavaScript expression" are available, as this can be used to make any event conditional.

  • in the clause with subquery in oracle

    Hi friends,

    I have two tables say table1 and table2 with details below

    create table test1 (identification number, name varchar2 (20));
    Insert into test1 values(11,'micro');
    Insert into test1 values(22,'soft');


    create table test2 (identification number, name varchar2 (20));
    Insert into test2 values(77,'micro,soft');

    (1) if I use under request I do not receive either delivering lines
    Select * from t1 test1 where t1.name in (select "': replace (t2.name, ','" ', "') |") ' from test2;

    (2) if I had the fire out one subquery I get is: "micro", "smooth".
    Select "' | Replace (t2.name, ',' "'," ') | " ' from test2;

    But if I fire the query (1) I need the result
    name identity
    ------------
    11 microphone
    22 soft

    can someone please help me to get the same result with a query (1).

    Few things

    1. your table TEST2 is not in first normal form (1NF). It's ugly!

    2. IN paragraph does not evaluate a single variable or a column with values defined as several values, they are just single value.

    FAQ a few details, read Re: 7. the list of values in an IN clause?

    And this is how its done (one-way)

    SQL > select id, name
    test1 2
    3 where name in)
    4 Select regexp_substr (name, "[^,] +', 1, level")
    5 of test2
    6 where id = 77
    7. plug
    8 per level<= length(name)-length(replace(name,="">
    9                 );

    ID NAME
    ---------- --------------------
    11 microphone
    22 soft

  • Disable the hyperlink with conditional formatting

    Hi experts

    I have an analysis of HTML code.

    My analysis have different ranks:

    Entity link - value
    Entity1 - 12
    Entite2 - 23
    Entity3 - 33

    Link entity is a column with a hyperlink or HTML.

    I want to deactivate a hyperlink in some entities in my report by using the conditional formatting... but I don't know how I can do this...

    The entity column has data Format: @[html]@H so I can see the link instead of html code... but I see links to all the lines...]

    In the conditional formatting, I can substitute data Format, but I don't know how to disable the link...

    Any help?

    Hello

    To disable a link via CSS, you could use the CSS properties:

    pointer-events: none;
    cursor: default;

    However, the first property does not work in Internet Explorer. You can test whether they work in other browsers and check if it fits your requirement.

    Thank you

  • [SQL] Where the problem of the clause with subqueries

    Hello

    I am writing a query for an apex application where I have a field (P47_UNNR) for filtering. In my where clause I try to do this:

    ... AND IN qo.pk_id
    CASE
    WHEN: P47_UNNR IS NULL
    THEN
    (SELECT pk_id FROM quote_orders)
    ON THE OTHER
    (SELECT QOR. FK_QUOTE_ORDER_ID
    OF QUOTE_ORDER_RIDS QOR
    JOIN THE
    RID RID
    WE RID. PK_ID = QOR. FK_RID_ID
    WHERE RID.NAME LIKE: P47_UNNR)
    END
    ...


    But it gives an error "ORA-01427: einreihig subquery returns more than one line.

    I tried several ways to work around this problem, but don't seem to be able to do. Does anyone have a suggestion on how to fix this?

    Try something like...

    AND qo.pk_id IN
    (SELECT pk_id FROM quote_orders WHERE :47_UNNR IS NULL
     UNION ALL
     SELECT QOR.FK_QUOTE_ORDER_ID
     FROM   QUOTE_ORDER_RIDS QOR
            JOIN RIDS RID ON RID.PK_ID = QOR.FK_RID_ID
     WHERE RID.NAME LIKE :P47_UNNR
    )
    
  • the clause WITH XMLNAMESPACES xmltable: do you go on the internet for xsd?

    Hello

    I have a request of xmltable passing an xmltype variable.

    Something like this:
    select id, name, data
    From XMLTable(XMLNamespaces ('https://www3.somesite.es/bla/bla/bla/thexsd.xsd' as "n1" , 
                                        'https://www3.somesite.es/bla/bla/bla/otherxsd.xsd' as "co") , 
                         '/n1:some/tag' passing l_my_xmltype_var 
    COLUMNS id        NUMBER(20)      PATH '//n1:id' ,
                                 name        VARCHAR2(9)     PATH '//n1:name' ,
                                 data     VARCHAR2(125)   PATH '//co:datatxt') X
    This query is executed in a loop, and we try to improve its performance.
    S/n told me that whenever the query is run, we need to get the two xsd via internet.

    1. is this true?
    2. If it is... Can I keep the local XSD or even inside the database? (I heard something on the registration of the scheme)

    Thank you

    Julius says:
    The actual query has more than 75 columns. Its consumption is spent on java, so I have to assume that this is because of the money the xmltable process analysis.

    You OR do something (horribly) wrong OR should move to a longer version of database great or equal to 10.2.0.3.x

    PLEASE post your version of the database (all figures!)

    Do you mean that, even working with a local xmltable passing a variable xmltype (not a structured xml real chart), save the scheme will do good performance?

    Yep, for example by avoiding calls JAVA... through the registered XML schema validation is optimized if not only because of its kernel code, it's C - code

    I guess I have to:
    1 save the xsd
    2 reference him when I create the xmltype variable (by adding the second parameter to the function of xmltype).

    Fix.

    Then, during the treatment of xmltable, the engine will be smart enough to use the xsd saved info to improve the query performance? Okay, I'm a little skeptical, but will give it a try.

    I will also try to facilitate the processing by specifying the path of the full tree instead of using "/ / tag.

    It will make a difference (providing you're at least on 10.2.0.3.x regarding the use of XMLTABLE, the XQuery engine...)

    As a curiosity, all this quest for optimization of query came when - after a change - the performance of the query went from 5 seconds to 90 seconds. Things went south when I added a * in select it the list instead of referring columns with their names. So it doesn't seem a good idea to use * with a high column number xmltable

    Perhaps, but cannot say. These questions depend on many parameters and environment settings. It could be a connection problem or... or...

    It's one of the reasons why we need the version of database for you give a better answer...

    Published by: Marco Gralike June 8, 2011 11:17

  • Identification algorithm of bad signature when the signature with SHA256

    It is more a bug than a feature.

    We have a PDF file that can be signed using Adobe Reader.

    If we sign using Adobe Reader 8, the hash algorithm is sha1. All right.
    If we sign using Adobe Reader 9.3.2,and default hash algorithm is sha256.

    Well, if analyze us the PKCS7 after having signed with version 9.3.2,and we found that in the signerInfo:
    -If decrypt us the RSA signature, it contains a sha256 hash.
    - but the signatureAlgorithm value is ' 1 2 840 113549 1 1 5'. This means pkcs1-sha1WithRsaSignature.

    The value of the content.signerInfos [0] .signatureAlgorithm field must be rsaEncryption or sha256WithRSAEncryption.
    But do not sha1WithRsaSignature.

    Do you know if this will be fixed in a newer version?

    Hello

    First place, Bravo to you to find it. Not there is that a lot of people in the world who can dig into that at this level, and I'm impressed that you found this.

    Now to the meat and potatoes. I bet you use a digital ID to sign up with what happens in the Windows certificate store. Acrobat (and when I say Acrobat I mean really both Acrobat and Reader) has access to two built in signature management. We're compatible PPKMS MS-CAPI Manager (as Acrobat is a consistent application of CAPITAL) and the other is the local Manager of PPKLite. If the digital ID chose to sign with is in the Windows then Acrobat default certificate store using the CAPI compatible PPKMS Manager and let the Windows encryption package to do all the work. It is PPKMS (or more precisely, our friends in Redmond) as the return of the incorrect SignatureAlgorithmIdentifier. All we do is write the PKCS7/CMS object with the data returned by Windows, if we let the PPKMS do the work.

    If you were to sign with a digital ID which is located in a P12 or PFX and not a digital ID in Windows, then Manager of signature of Adobe PPKLite would do the job and you will see the value of equal to 1.2.840.113549.1.1.1 SignatureAlgorithmIdentifier rsaEncryption.

    There is a case to be made that the SignatureAlgorithmIdentifier value must be a compound algorithm where it includes the collection and encryption methods, but this isn't a requirement. When Acrobat is the validation of the signature is the DigestAlgorithmIdentifier to recalculate the hash and analysis in fact the SignatureAlgorithmIdentifier keep the part EncryptionAlgorithmIdentifier and launch the part of digest method.

    The key is, it is a bug of Microsoft, and Yes, I have already told them.

    Steve

  • with the clause with union all?

    Hello

    I tried to use 'by' article with union all. .but it gives me error...
       with t1 as 
            (select '1'col1 from dual union all
             select '2' col2 from dual)select * from t1
             union 
            with t2 as 
            (select '3' col1 from dual union all
             select '4' col1 from dual )
              select * from t2
                
    What harm am I doing here? Thank you very much!!

    Use the WITH clause, once for you all the subqueries, and then add the main request;

    with t1 as
     (select '1' col1
      from dual
      union all
      select '2' col2
      from dual),
    t2 as
     (select '3' col1
      from dual
      union all
      select '4' col1
      from dual)
    select *
    from t1
    union
    select *
    from t2;
    

Maybe you are looking for

  • Supported HTTP/2 trailers

    HTTP/2 project-14 section 8.1. allows a frame to headers optional ("trailers") following frames of DATA in the HTTP request and response. https://Tools.ietf.org/html/draft-ietf-httpbis-http2-14#section-8.1 This is necessary to support the implementat

  • How to download google earth for my iMac?

    Uninstall Google Earth because I could not remove marks that I put on the map a few years ago. How can I download / reinstall Google Earth to my iMac?

  • Driver not found Bluetooth Windows 7

    Can anyone help me regarding the Bluetooth device for my laptop. My model is hp dv6701vx. It is said that the drivers for the device is not installed. Currently, my laptop runs on 32-bit windows, professional reception. Thanks for any help in advance

  • How to increase the life of the battery of my laptop?

    BY plugging charger or by plugging in only when the battery gets low?

  • AOL Dialer

    MY AOL DIALER IS VERY SLOW, IT TAKES ABOUT 5 MINUTES TO CONNECT...