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

Tags: Database

Similar Questions

  • How can I replace the windows with ScanGear tool analysis tool much better? MX882 on Windows 10 Pro. ?

    I have a PC on which I instaled the Canon drivers live cannon and I love the ScanGear interface. It surved upgrade Windows 7 to 10 Professional. On the other hand, for my other PC in the home group, I let windows install the drivers for the MX882. Scanning windows interface is limited! How can I get the ScanGear interface to replace the windows tool?

    Thank you!

    B

    ScanGear is just the scanner driver. Are you talking about software, Canon MP Navigator EX scanning? Which is available for download from the Web site.

  • How can I replace the same clips with the same interval of time (same settings)?

    Dear Adobe Premiere CS5 Forum,

    I have the following problem, and I would look forward to receiving solutions:

    As I couldn't cut my video with clips in avi codecs (it is very difficult to cut in avi codecs, except that you have a very fast computer), I converted my raw clips in lower codecs. Then I cut my video in low quality codecs. My video is now ready to export.

    But before I want to export my video, I need to replace all the clips in avi codes so that my video is in good quality.

    Now the problem:

    How can I replace the clips (poor quality video codec codec avi), in order to have the same clips in a different codec always the same interval of time. I want the replaced clip immediately have the same interval of time.

    For example: a raw whole clip takes 2 minutes. But just a part / interval of the clip (from 01:00 minute 01:10 minutes) is shown in the video. Now I want to replace this clip with the same clip in avi codec. But it must be the same interval (from 01:00 minute 01:10 minutes).

    I tried to replace a clip. But they each have a different time interval (the lower quality clip is from 01:00 to 01:10 minutes and if I would like to replace the same clip in avi codec is the time interval between 0:00 to 0:10 minutes).

    How can I replace the clip with the same interval of time?

    Thanks in advance

    Leonardo

    Hold down the Alt + Shift; It is Shift that maintains the reference timecode. In addition, this will work only if your proxy clips contains timecode. If they all start to 00:00:00:00, this will not work for you.

  • 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.

  • 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 the cooling on an Acer V5 fan?

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

    I sent you a private message

  • I have 2 orange records for professionals but Windows XP cannot find the CD - how can I replace the CD? __

    I have 2 orange folders for Windows XP Professional, but it is impossible to find the CD - how can I replace the CD?

    I made myself, and it will cost about $23 (assuming, of course, that you have the product key)...

    How to replace Microsoft software or hardware, order service packs and upgrades, and replace product manuals...

    http://support.Microsoft.com/default.aspx?kbid=326246

  • How can I replace my app on iTunes Connect with a new version with air for iOS and app Loader?, how do I replace my app on iTunes Connect with a new version with AIR for iOS and the Application Loader?

    How can I replace my app on iTunes Connect with a new version with air for iOS and app Loader?, how do I replace my app on iTunes Connect with a new version with AIR for iOS and the Application Loader? I got an error that the version number needs to be updated. I created a new record in iTunes Connect with version 1.1 and I took ownership of my current app 1.1 in air for iOS section in Flash.

    Check your descriptor file to make sure that it shows the updated version, too.

  • How can I replace the old system of comments by Disqus?

    How can I replace the old system of Business Catalyst with Disqus comments? Help, please

    The universal integration for Disqus code is just javascript.  You must register for an account on http://disqus.com/for-websites/ and set up your account first.  Once you have changed your settings, click on the link 'Install' and which will give you code javascript to add to your pages as well as a few other tips to make it work.

  • How can I update the rubrics with WebServices?

    How can I update the rubrics with WebServices?

    /Anyone/ has some success with this?

    It becomes important to our business objectives in order to solve the problems within the control elements.

    I can't enter the number of line by line in order to uniquely identify it. How can I get that number, so I can send it with xml "update"?

    A little nudge in the right direction would be much appreciated.

    Aaron.

    You must use a field on the form as the one on the line items, NOT the line number that appears in the journal of the line item. If I understand correctly, the LineItemIdentifier can be any field on the form, even the short description. It is best if you know you will use web services to update the line items, you add a (potentially hidden) field to the form and fill that with unique values when positions are created. If you are working with existing elements of line, then you must choose a field that will be usually unique within a single record and hope, you don't have a lot of duplicates.

  • How can I configure the element with the script names?

    Could Hello someone give me a hand?

    I created symbols on the stage of this script below.

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

    for (k = 0; k < 5; k ++) {}

    sym.createChildSymbol ("mySymB", "Stage");

    }

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

    How can I configure the element with the script names?

    Because, when I try to control a symbol by using the getSymbol("---") command.

    I need to know the name of the item given to each symbol.

    Concerning

    Yes, you're right.

    Using 'Code-Example' If you write sym.getSymbol ("mySymB") that edge returns the undefined value.

    With "Drag-and-drop-Example", you can use sym.getChildSymbols ().

  • How can I make the popup with empty fields and create new record?

    I would use a popup create new record.
    I created an af:popup drag and drop a data control VO in jsff. Then, I created a button and place an af:showPopupBehavior. I was able to pop-up window by clicking on the button.
    However, the window filled with information from the record 1. and when I select a record in the table and click on the popup, the popup is filled with this record.
    How can I make the popup with empty fields and create a new record by recording the popup?
    Thank you

    Hello

    You must call the CreateInsert for the underlying ViewObject operation when opening the popup because it does not allow to clear the input field, you must have a new record created

    Frank

  • How can I replace an old site (unknown host) with a new site of Muse?

    Here's my situation:

    I want to start by webdesign for more money while studying. Now, I did a nice site for a doctor (he is not yet informed) that actually has an ugly home page. So I intend to offer my website, including the replacement... but I don't have an idea how to replace an old site (leave a host I don't even know at this time, but I know...) with a new one.

    So my questions here:

    Should I ask him?

    What is the FTP?

    How can I replace the site?

    Thanks a lot for your help.

    Greetings,

    Vicky

    Hi Victoria,.

    If you are completely redefining the site, you can delete all files from the assistance of the host server, and then download a fresh site using the Muse ftp credentials.

    Kind regards

    Akshay

  • How can I replace the sequence as in the scneario below

    Hello

    I am trying to achieve something like below.   I have the column named "GRN_SEQUENCE" in a table where she will always be one of below value, because that; s how the front has been designed. Its value is from 1 to 9, A to z, a through z, but we must represent this in digital mode. I'm going in the right direction? How can I increase the value if the value of grn changes?

    What I'm trying

    SELECT DECODE (GRN_SEQ), 2, '01'

    A, '09'.

    a, '36',

    The result of the 'UK') twice;


    I "try to get by the DECODE function as below but running of ideas now.  so please share your ideas on the question of whether I can achieve it all first. But the bottle is I should this in a function of a set that too a for loop.  so there is no constant value and the value will always get change as this feature will go in a loop in a loop.

    For a better understanding

    IF GRN_SEQUENCE IS BETWEEN 2 and 9, then the value will be as for 2 we 01, for 3, he will be 02 and 9, 08

    IF the value is A to Z for A - 09, B-10... Z-35

    If the value is a-36 z-62 b - 37.

    Thank you.

    Hello

    If you prefer to use ASCII instead of the INSTR, you can do it like this:

    SELECT grn_sequence

    TO_CHAR (ASCII (grn_sequence)

    -CASE

    WHEN grn_sequence BETWEEN '2' AND '9', THEN 49

    WHEN grn_sequence BETWEEN 'A' AND 'Z' THEN 56

    WHEN grn_sequence BETWEEN 'a' AND 'z' THEN 62

    END

    , "FM00.

    ) AS a result

    OF good_owned

    ;

    Interested the 3 types of characters (numbers, uppercase and lowercase letters) occupy 3 contiguous blocks of ASCII character codes, corresponding to 3 branches of the CASE expression:

    1. '2' to '9' characters have values ASCII 50 to 57 (i.e. 49 higher than what you want)
    2. Letters from 'A' to 'Z' have ASCII 65 to 90 values (either 56 higher than what you want)
    3. Characters 'a' to 'z' have ASCII values 97 to 122 (i.e. 62 higher than what you want)
  • How can I replace the video card in my Pavilion a6357c desktop PC

    My monitor is completely empty - and on the health check - free service at Office Depot - looks like my video card is nonfunctional - how can I buy the part and change the video or equivalent card?

    cschan wrote... "I tried to look it up to accesorries in HP Web site or on the internet / amazon etc to find a similar card, but to no avail as the map is not clearly specified on the specs of the computer, nor on the removed card from the computer.

    @cschan... As I mentioned previously, your system is not a graphics card... the graphical subsystem is part of what is called the chipset. Your computer will accept almost any card PCIe x 16 market chart, however the 250 watt power supply will limit your choices. Buying a new power supply will give you more chioces, but it's an additional expense. The two components will run around $100 - $150.

    I would say a little more troubleshooting before investing in some new parts. Borrow a well-known work PCIe x 16 graphics card and install it in your computer to see if your problem persists.

    Frank

  • Re: Satellite A50 - how can I change the boot with BIOS password priority?

    I have a Satellite A50. I need to restore to factory default to recover DVD, how do I boot from the DVD?

    The default boot priority is the HARD drive and is more bootable has been formatted. My BIOS is password protected, how can I change the boot priority? After having inserted the password, its always boot from the HARD drive.

    Thank you

    The boot priority, that you can change in the BIOS.
    Go into the BIOS with ESC, enter your password and then you can change it.
    But don t forget to save the changes.

    That s all and then you can boot from the CD.

Maybe you are looking for