How can I replace a value

Hi guys,.

Maybe, you can help in this query,

SELECT crm where the project = Br: P2_Project

: P2_Project: is 'point a value in a list of values' that contains X, Y, Z

Only if the value of 'X' is selected, then it should be replace another value such as 'A'; It should then be compared against the values of the project column.

How can I do this...? I hope that my question is simple...

Best regards
Fateh

Hello

What you posted is equivalent to:

SELECT distinct
     br
FROM      crm
where      project = CASE
               WHEN  :P2_PROJECT IN
                    ( 'ET-H'
                    , 'ET-B'
                    , 'ET-C'
                    , 'ET-D'
                    , 'ET-E'
                    , 'ET-F'
                    , 'ET-J'
                    , 'ET-K'
                    , 'ET-M'
                    , 'ET-L'
                    )
               THEN  'ET'
               ELSE  :P2_project
           END
;

It's a little less coding, and (I think) clearer.
In Oracle 10 (and more) you can do this, too:

SELECT distinct
     br
FROM      crm
where      project = CASE
               WHEN  REGEXP_LIKE ( :P2_PROJECT
                           , '^ET-[HBCDEFJKML]$'
                           )
               THEN  'ET'
               ELSE  :P2_project
           END
;

but, if the list of values never changes so that it follows such a clear trend, then it might be more difficult to maintain.

Tags: Database

Similar Questions

  • How can I replace the value of the column with a particular value in SQL

    Hi all

    Is someone can you please tell me how can I format my output with the replacement of a column value with a specific value that really depends on the current value of the column

    I am executing the following SQL statement

    Select state, count (id) from < table_name > where composite_dn = < composite_dn_name > Group by State;
    My current performance is:

    State Instance number
    1 3
    3 28

    I want to replace the value in the State column as follows

    No.OfInstances State
    3 filled
    28 faulted

    I want '1' to be reppaced of 'Done' and '3' is replaced by 'Faulted. '

    Is is possible with SQL or PL/SQL, if it is then how I can achieve this required. Help, please!

    Thanks in advance!

    Published by: Roshni Shankar on October 27, 2012 12:38 AM

    Hi Claude,.

    I guess this CASE clause can be simulated by a DECODE and also it is very easy to use.
    See - http://www.techonthenet.com/oracle/functions/decode.php

    select decode(t1.state,t2.state_id,t2.state_name), t1.count_id
    from  t2, (select state,count(id) count_id
     from 
     where composite_dn= 
    group by state) t1
    where t1.state = t2.state_id;
    

    HTH
    Vanessa B.

    Published by: Vanessa B on October 27, 2012 14:02
    -link added

    Published by: Vanessa B on October 27, 2012 14:19
    -added code sample

  • How can I get a value from a function from pl/sql by OADBTransaction

    Hi all
    Hope you will be fine.
    as we know, we can get a sequence by this code value:
    Super.Create (AttributeList);
    Transaction OADBTransaction = getOADBTransaction();

    Vendor ID is obtained from the table sequence
    Number supplierId = transaction.getSequenceValue ("FWK_TBX_SUPPLIERS_S");

    My question is how can I get a value in a variable to a pl/sql function:
    the function is defined as follows:
    ******
    create or replace function getNextTrans return varchar2
    is
    Team varchar2 (20);
    Start
    SELECT "CASH". TO_CHAR (SYSDATE, 'DDMMYYYY') | GP_CASH_TRX_SEQ. NEXTVAL FROM DUAL;
    return team;
    end;
    /

    Hey Dina,

    Reference http://www.oraclearea51.com/oracle-technical-articles/oa-framework/229-calling-database-procedures-and-function-from-oaf.html

    Kind regards
    GYAN

  • How can we replace the display of a keon?

    I am a representative of the Mozilla's Rwanda.

    I gave one of the 3 keons, I got from Remo to a member of my community to work on applications, and the screen is broken on his watch. How can I replace the screen?

    AZ charadi
    Mozilla Rwanda Rep
    https://mozillians.org/en-US/u/AZ/ | https://reps.Mozilla.org/u/AZ/

    AzAnitah said

    I am a representative of the Mozilla's Rwanda.

    I gave one of the 3 keons, I got from Remo to a member of my community to work on applications, and the screen is broken on his watch. How can I replace the screen?

    AZ charadi
    Mozilla Rwanda Rep
    https://mozillians.org/en-US/u/AZ/ | https://reps.Mozilla.org/u/AZ/

    Hi Liz Az,.
    I think it will be better if consult you with the Center nearest mobile maintenance any hardware problem.

  • I am trying to replace my iphone 6 s model n °: A1688, FCC ID: BCG-E2946A, IC: 579C-E2946A. but I can get the serial number because its doesn't turn only not on how can I replace it?

    I am trying to replace my iphone 6 s model n °: A1688, FCC ID: BCG-E2946A, IC: 579C-E2946A. but I can get the serial number because its doesn't turn only not on how can I replace it?

    Take it to your local Apple store. They will find it for you.

  • HOW CAN I REPLACE EXPIRED INK CARTRIDGE IN THE PRINTER ALL IN ONE HP OFFICEJET PRO L7780?

    HOW CAN I REPLACE EXPIRED INK CARTRIDGE IN THE PRINTER ALL IN ONE HP OFFICEJET PRO L7780?

    I DO NOT PRINT A LOT AND I HAVE TWO PRINTERS. THE EXPIRATION DATE ON THE CARTRIDGE, THE PRINTER DOSE NOT LET ME PRINT. I KNOW THAT THERE IS WAY TO OVERRIDE THIS PROBLEM, BECAUSE ON MY PREVIOUS PRINTER THEY REPLACES THE KEY.

    The error message itself will remain but will continue to print. This message will remain until the cartridge is replaced. Substitution is the printer printing always regardless of the error message on the display screen.

  • How can I replace the Playlists tab on bottom of Apple's music with the Connect tab?

    How can I replace the Playlists tab on bottom of Apple's music with the Connect tab?

    Found my own answer online.  It's in the Restrictions under settings.

  • How can I replace my old ID with a new one.

    Yesterday I did and upgrade to 9.2 when finished my old ID pop up with my old email address, try to change but cannot do, how can I replace it with the new.  Sorry I don't have and Ipad 3gen.

    You will need to disconnect from the former Apple ID and then sign in with a new one.

  • He miss the Safari browser, how can I replace it?

    I'm on a Mac OS X Version 10.8.5, processor 2.2 GHz Intel Core 2 Duo, memory 6 GB 667 MHz DDR2 SDRAM, NVIDIA GeForce 8600 M GT 128 MB graphics.  Miss me the Safari browser, how can I replace it?

    If it's in a backup, restore from there. Otherwise, save your data (as a precaution), reboot with the command and R keys, and reinstall the OS.

    (137948)

  • How can I change the value of a control on front panel?

    On the front panel, I'm doing a complex control that consists of a Slider control and control of the digital inputs. Both controls display the same information and either may be used for entry. When changing value, I want the other control to display the same value.

    How can I change the value of a control on front flap when another control changes the value? I know how to use a structure of the event to detect value has changed, but I do not know how to impose control on front panel to change its value in the block diagram.

    Why do you not use a digital display on the slider, and no code is required:

    EDIT: Yes, he said. ***

  • How can I replace my Microsoft Wireless Mobile Mouse USB receiver.

    How can I replace my USB receiver. I just lost and I only want to buy a newer version for distributor of mouse Microsoft Wireless mobile mouse 4000.

    Hello

    Check with your local retailers and Microsoft Hardware Support.

    Microsoft Hardware support
    http://www.Microsoft.com/hardware/en-us/support

    Microsoft Hardware - contact us
    http://www.Microsoft.com/hardware/en-us/support/contact-us

    I hope this helps.

    Rob Brown - Microsoft MVP<- profile="" -="" windows="" expert="" -="" consumer="" :="" bicycle=""><- mark="" twain="" said="" it="">

  • How can I write the value of floats Unitronics vision230 PLC with modbus Ethernet

    How can I write the value of type Float in unitronics PLC Vision230 modbus ethernet (Ethernet Master Query.vi MB) usinsg I read and write register 32 bits, for example, I want to write the value 23.45 2nd Add. MF. And registry MF is the 32-bit registry. I read and write register 32-bit.

    Narendra.

    Narendra,

    Two characters can type cast into a uint16 you VI supports.

    To summarize. Take one (4 bytes). Flatten it to a string (4-byte) divided this string into two parts of 2 bytes each. Cast in u16 (16 x 2 = 32-bit).

    However, if you really want to follow the IEEE standards then you will need refer this KB. His is not that simple, but seems closer to what you are looking for.

    Amit

  • my disk dir. winxp home became unusable, how can I replace

    my disk dir. winxp home became unusable, how can I replace

    Hello

    Check out the links and call to the number indicated in the article to order a replacement for Windows XP drive.
    How and when to contact Microsoft and support Customer Service
    http://support.Microsoft.com/kb/295539
     
    Also.
     
    How to replace Microsoft software or hardware, order service packs and replace product manuals
  • How can I replace the cooling on an Acer V5 fan?

    How can I replace the cooling on an Acer V5 fan?

    I sent you a private message

  • How can I set default values to set the Mode in the config of the AO?

    Hi, how can I set default values to allocate mode in the config of the AO. To be precise, in the attached vi, I need to set the Mode allocate in the AO Config to ' use FIFO memory (6) ' if the value inside the structure of my case is false and 'no change (0)' if the value inside the strusture case is true.

    Create two constants for Mode allocate input (right click > create > constant). A place in the real case of the structure of the case and place it in the case of false. Their son in the same tunnel (border of the structure of the case), then the tunnel of wire to the pole to allocate the AO Config Mode. I do not have traditional DAQ installed, but who should do it.

Maybe you are looking for