Nvl question (kind off)

Hi guys,
I was wondering if you could help me out please.
I have a table with a start_date and end_date as well as a temp_start_date and temp_end_date column.
What I want to do is display the start_date and end_date BUT, if the start_date is null I want to show the temp_start_date and temp_end_date in that column.
I was thinking I could use nvl or possibly decode to do this?
The first bit I think is straight forward, I nvl the start_date to the temp_start_date, but im not sure how to proceed from there? I only want to show the temp_end_date if the start_date is null. Any help on this would be greatly appreciated.
Select nvl(start_date,temp_start_date), end_date
From my_table
Thanks

Hi,
Use the NVL<b>2</b> function for that
SELECT     NVL ( start_date
         , temp_start_date
         )          AS s_date
,     NVL2 ( start_date
          , end_date
          , temp_end_date
          )             AS e_date
FROM    table_x
;You could use DECODE or CASE to test if start_date is NULL, and, depending on the answer, return either end_date or temp_end_date, but NVL2 was designed specifcally to do that. That is, the NVL2 expression above is equivalent to
,     CASE
         WHEN  start_date  IS NOT NULL
         THEN  end_date
         ELSE  temp_end_date
     END             AS e_dateand also
,     DECODE ( start_date
            , NULL     , temp_end_date
                       , end_date
            )        AS e_date 
I hope this answers your question.
If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all the tables involved, and the results you want from that data.
Explain, using specific examples, how you get those results from that data.
Always say what version of Oracle you're using (e.g. 11.2.0.2.0).
See the forum FAQ {message:id=9360002}

Similar Messages

  • Kinda off topic question about Naps

    Mod... feel free to close this if you feel you have to. I figured I might get a good response asking this here though.
    Anyway, I have a Zen Touch and a napster subscription. I liked the idea of being able to basically sample music (via the subscription) and then buy what I really like. Anyway, yesterday I bought my first album. It was an album that I had already downloaded via the subscription. I was under the impression that buying the album released any protection on it, and thus I would have a bunch of unprotected wma files. But after copying the wma files to another computer, I found this was not the case. I tried playing those files on the computer, and windows media player was still looking for my napster license. I was able to burn the tracks I purchased to a CD, like I'm supposed to be able to after purchasing them. But, is this what I have to do to "keep these tracks forever"? If my subscription runs out, will I not even be able to play the WMA files that I purchased? If that's the case, then this whole thing is disappointing. I was under the impression that by buying the tracks, they would no longer be tied to my napster subscription in any way, and I could create a library of wma tracks that I purchased, which I would be able to play and do whatever I want with after my subscription runs out. If I have to burn all my purchased tracks to CD to keep them forever, then what's the point of buying digital music? I still have to create a clutter of CDs if I want to keep the music. I realize of course that I could just rip the songs off the CDs I burn to have an unprotected file, but that's ridiculous.
    Does iTunes work like this? I.e., if I buy a track, it is still protected in any way?

    All DRM (WMA DRM or Apple Fairplay) stays with purchased tracks forever, UNLESS you burn an audio CD. On that audio CD there is no DRM anymore. You can rip it back into anything. Same thing in Napster, Yahoo, MSN Music, iTunes, etc..
    Here's how Napster works: You put Napster software (or WMP Napster plug-in) on as many computers as you want. No limit. Each track you buy gets a license to play on up to 3 computers. That's all. This license is for each track, not for Napster itself. You can have various tracks on many different computers so long as one track only plays on 3. When you go to, say, computer number two, you "synchronize" your Napster downloads. This puts all the stuff you downloaded or bought on that computer, too. Now you can play your purchased stuff on the second computer. Napster looks at the tracks you need on computer number two and automatically downloads a copy there when you synchronize. You do not need the full Napster software to do any of this--the WMP plug-in will work just as well. Tracks you download only (don't buy) will expire. The license will not allow them to play after you quit Napster. Tracks you buy from Napster have a license that does not expire. I have a whole bunch of these and I left Napster in September. They all play and all download to my Zen players, too. I just burned a few to CD recently, too.
    Message Edited by MikeM32 on -29-2005 0:5 AM

  • Kind off topic, but i have some TERMINAL questions

    I really want to get into terminal, really learn how to use it
    is there any official guides or any good guides taht can get me started and teach me everything or just enough??
    pleae help

    HI,
    Best place to post for help with Terminal is here.
    Get under the hood with Command Line and the Terminal
    O'Reilly's book here is good. http://search.oreilly.com/?q=terminal
    Carolyn

  • Newbie wireless question (slightly off-topic)

    I didn't want to post this here as it's not entirely an Airport-specific question. I posted this to the iBook forums, but nobody there has answered so my apologies if this is not welcome here. (Any moderators can remove it if that's the case.)
    I've been using computers extensively for over a decade, but I'm a total newbie to wifi. I just set up a wireless network in my house and would appreciate some advice/feedback.
    My main concerns are whether or not my network is reasonably secure. I know there is no such thing as perfect security, but I don't know if what I've done is good enough or not.
    I don't have an Airport base station, but I do have a D-Link Airplus G and an Airport card in my iBook. I have WEP set up on the router and I have enabled MAC filtering, listing only my desktop and my iBook, excluding all others from the network.
    I'm fairly certain that nobody in my neighborhood is going to get into my machines this way or be able to sniff my network data stream, but am I right in assuming that nobody can "piggyback" on my Internet connection too? Presumably, if everyone but my own machines are MAC-filtered and kept out, then the Internet connection is also protected. Is that how it works?

    WEP and MAC filtering are better than nothing, but you can do better. These are my suggestions:
    1. Use WPA with a pre-shared key (PSK) and TKIP encryption on your Netgear router, along with an alphanumeric passphrase of at least eight characters not found in any dictionary. The equivalent setting on your Mac is "WPA Personal". Unlike WEP security (which an expert can crack in under half an hour), WPA security is currently unhackable by any practical means as long as you use a non-dictionary passphrase. One last point - WPA security requires all your wireless Macs to be running MacOS 10.3 or newer.
    2. MAC filtering is (these days) essentially useless as a wireless security method. Using "packet sniffing" of traffic on your wireless network to find out what MAC addresses are used by computers on your network, and a PC that allows its MAC address to be cloned so that it is identical to the MAC address of one your own wireless computers (which is possible with most PC wireless network adapters) even an amateur hacker can defeat MAC address filtering in minutes.
    By the way - I don't think your posted message here is off topic. In my opinion, the Airport discussion forums are the best place to post any questions related to usage of wireless networks. Questions of this nature are virtually never specific to any Mac model.

  • How do I get my security questions taken off?

    How do I reset or take off my security questions

    You need to ask Apple to reset your security questions; ways of contacting them include clicking here and picking a method for your country, phoning AppleCare and asking for the Account Security team, and filling out and submitting this form.
    They wouldn't be security questions if they could be bypassed without Apple verifying your identity.
    (103155)

  • It is Urgent & Important Questions Kindly !

    Hi Friends !
    Following are some questions... kindly if u can help for any or all?
    Q1) Want to generate all .fmb into .fmx using DOS batch programing or any other mathod.Is it possible at all ?
    Q2) As u know when the LOV invoked it shows your columns' values
    vertically as,
    Code Name
    01 abc
    02 cdef
    03 ghijk
    My question is that,is it possible at all if i could get the LOV
    horizontally as
    Code 01 02 03 -- --
    Name abc cdef ghijk -- -- etc... For the web & in normal Builder ?
    Q3) I want to print the form(Form 6i) not as we can do by using the
    default menu's option "Print" which actually print the whole screen with
    menu & buttons & etc..
    I want to print the all values i.e information including those values
    which we see using scroll bar in the detail data block.As we can achieve
    it using report but report is not required.I remember that someone has
    told me using TEXT_IO package's functions.
    But i did not succeeded.Can u help me in this interesting assignment ?
    Q4) Want to print the images stored in the database as other normal
    fields using report. As the query ...select code,name,image from
    employee........ or using any other method.
    Q5) For the performance of Form's LOV prob. I found the .jar files named
    E:\Oracle\ias\6iServer\Forms60\Java\f60all.jar
    But I did not find any LIB directory in the Html page of my browser etc.
    Kindly may you exactly tell me where the LIB of html of browsers is ?
    MANY MANY THANKS !
    null

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Imran_Oracle:
    Hi Friends !
    Following are some questions... kindly if u can help for any or all?
    Q1) Want to generate all .fmb into .fmx using DOS batch programing or any other mathod.Is it possible at all ?
    Q2) As u know when the LOV invoked it shows your columns' values
    vertically as,
    Code Name
    01 abc
    02 cdef
    03 ghijk
    My question is that,is it possible at all if i could get the LOV
    horizontally as
    Code 01 02 03 -- --
    Name abc cdef ghijk -- -- etc... For the web & in normal Builder ?
    Q3) I want to print the form(Form 6i) not as we can do by using the
    default menu's option "Print" which actually print the whole screen with
    menu & buttons & etc..
    I want to print the all values i.e information including those values
    which we see using scroll bar in the detail data block.As we can achieve
    it using report but report is not required.I remember that someone has
    told me using TEXT_IO package's functions.
    But i did not succeeded.Can u help me in this interesting assignment ?
    Q4) Want to print the images stored in the database as other normal
    fields using report. As the query ...select code,name,image from
    employee........ or using any other method.
    Q5) For the performance of Form's LOV prob. I found the .jar files named
    E:\Oracle\ias\6iServer\Forms60\Java\f60all.jar
    But I did not find any LIB directory in the Html page of my browser etc.
    Kindly may you exactly tell me where the LIB of html of browsers is ?
    MANY MANY THANKS !<HR></BLOCKQUOTE>
    Soory if I Know only a reponse for your first question: You can use the Project Builder. You must create a project a then incorporate all your fmb's and reports and so on. From there you can compilate all or some of the objects selected.
    null

  • Quick NVL question

    Hi,
    in the SELECT clause expression NVL(<col>,<val>), can <val> be an expression
    that includes other columns from the same table as <col>, or even other
    tables?
    Is the answer to the above question the same if the NVL occurs in the WHERE
    clause? (or ON clause in an [ANSI] join?)
    Thanks.
    Ken Quirici
    [email protected]

    for example you have a table as
    Tablea
    Col1 col2
    abc xxx
    abc xxx
    null yyy
    null yyy
    select nvl(col1,col2) from tablea
    abc
    abc
    yyy
    yyy
    select nvl(col1,col2) from tablea
    where nvl(col1,col2)='yyy'
    yyy
    yyy

  • Oracle BI Apps questions, kindly help

    Hi All,
    I wanted to checkout the preconfigured reports that come with Oracle BI applications, for this i had download and installed
    OBIEE 10.1.3.4.1
    ORacle BI Applications 7.9.5
    Informatica PowerCenter 8.6.0
    Oracle EBS R12,
    Question 1) I see that there is Oracle DAC 10.1.3.4 on the same download page, should i also download that as when i installed oracle BI applications 7.9.5 it installed DAC folder in OracleBI and i am able to access DAC client, so what is the need of separate DAC?.
    Question 2) When i installed Oracle BI Applications 7.9.6(after uninstallting apps 7.9.5), there was no DAC folder in oracleBI location, in the guide it said DAC folder has to be present from previous installation, i guesss that means i need to have oracle Apps 7.9.5 installed before i install apps 7.9.6?
    Question 3) Is informatica powercenter 8.6.0 compatible with above settings or do i need to install informatica from oracle website, i tried but it takes me to OBIEE download link
    http://www.oracle.com/technetwork/middleware/bi-enterprise-edition/downloads/bus-intelligence-11g-165436.html
    the softwares included are
    Included:
    BI Server Enterprise Edition
    Server Administrator
    Answers
    Interactive Dashboard
    Reporting and Publishing      Delivers
    Office Plug-In
    BI Publisher
    Scorecard and Strategy Management
    Real-Time Decisions
    WebLogic Server Standard Edition (restricted use) there is no Informatica in the above list!!!
    thanks for your help,
    regards,

    Hi,
    1) You need to download DAC also to configue the BI apps.you can go through this link for more info
    http://forums.oracle.com/forums/thread.jspa?messageID=5553233&#5553233
    2) You need to install either 7.9.5 apps or 7.9.6 version.....Because both are different that is BI apps 7.9.5 uses informatica....where as BI apps 7.9.6 will use ODI(oracle data integrator) and ODI doesnt use DAC for its installation.
    So go for either one of those....i would suggest you to go for 7.9.5
    3)Informatica 8.6.0 is compatable with 7.9.5 Apps.Google it to find informatica software.
    Hope your questions are answered.
    By,
    KK

  • My primary room changes in color disappeared..kinda off ???

    I am color correcting a project and all of a sudden all that I did in the primary room has vanished, except for what I did with the color wheels on my table.
    Its like i pressed a key that hides all of the information in the primary room, so I can no longer see the changes I made to the curves or to the color wheels on the sofware, but I can still see the changes that I did using my table.
    Has this happen to anyone? I cant figure out how to get that back, tried going back to a previous archive, turning everything off and on and nothing.

    I am color correcting a project and all of a sudden all that I did in the primary room has vanished, except for what I did with the color wheels on my table.
    Its like i pressed a key that hides all of the information in the primary room, so I can no longer see the changes I made to the curves or to the color wheels on the sofware, but I can still see the changes that I did using my table.
    Has this happen to anyone? I cant figure out how to get that back, tried going back to a previous archive, turning everything off and on and nothing.

  • Next Question - turning off the Iphone

    Any time I turn the Iphone off, a few seconds later it comes back on by itself. Is it suppose to do that? Is there a setting I can change?

    How are you turning it off?
    Have a look at the manual:
    http://support.apple.com/manuals/#iphone

  • Kinda off subject w/regards to CC - Fidelity Cash Management Account

    I know alot of people here have Fidelity Amex's and thus have Fidelity Cash Management Accounts as well aka a checking account.. With that being said, has anyone ever paid a credit card bill being insert the routing/checking account # from their fidelity Cash Management Account into the CC website such as Cap1/BofA/Amex as a checking account and have a successful withdraw from it?  I was going to set it up ot pay an Amex bill rather than my primary checking account, but last thing I would want it to do is not to work and get rejected due to not truely being a checking account.  Anyone have experience with setting one up on a CC companies website as a checking account and paying successfully?  Just don't want to be a guniea pig here and have it fail lol.. Granted I can transfer money from Fid Cash Management account to my primary banking account, but just curious on other peoples experience. Appologize if bad place to place this, mods feel free to move.  

    Creditaddict wrote:
    CreditCuriousity wrote:
    I know alot of people here have Fidelity Amex's and thus have Fidelity Cash Management Accounts as well aka a checking account.. With that being said, has anyone ever paid a credit card bill being insert the routing/checking account # from their fidelity Cash Management Account into the CC website such as Cap1/BofA/Amex as a checking account and have a successful withdraw from it?  I was going to set it up ot pay an Amex bill rather than my primary checking account, but last thing I would want it to do is not to work and get rejected due to not truely being a checking account.  Anyone have experience with setting one up on a CC companies website as a checking account and paying successfully?  Just don't want to be a guniea pig here and have it fail lol.. Granted I can transfer money from Fid Cash Management account to my primary banking account, but just curious on other peoples experience. Appologize if bad place to place this, mods feel free to move.  it has checks and bill pay on it's wesbsite so i can't see why there would be any issue and you could test it by doing it through their bill pay and push the payment instead of through amex and pull payment.Ya I could push a payment, but honestly kinda like pull payments better.. I wouldn't think it would be an issue either, but just curious with other peoples experiences if they have used it as a checking account and it truely worked.  I would think it would as I have checks from them.

  • How do I get the question marks off the albums?

       How do I get iTunes to download my music after a purchase?

    When you purchase, it downloads.

  • 2 quick questions, kind of nitpicky

    Hi all
    1. My new macbook says the battery is 99% charged (plugged in) and that it is fully charged; my old iBook always said 100% charged when it was fully charged. Is this the norm or have I 'lost' 1%?
    2. I have heard mention of cycles and have seen it on my iStat Pro widget; I'm sure I never saw mention of it in the manual. What are cycles, how many times fully charged from a certain percentage drained?
    Thanks ahead of time.
    M.

    Hi musashi88:
    1: This is perfectly normal behaviour, see Apple article http://support.apple.com/kb/TS1909?locale=en_CA
    2: Cycles is the number of times a battery has been discharged/recharged. One cycle can be a complete discharge/recharge, or a 50% discharge/recharge repeated a second time. You can check the number of cycles by clicking on the Apple in the left corner and select about this Mac, then More Info, and Power.
    Enjoy
    Stedman

  • I have a ipod touch 1st generation and it started to not to respond in some parts of the screen. Its kind off old it randomly turns off and on. What can i do? is there a way for apple to help me?

    I need help some one please help me

    Basics from the manual are restart, reset, restore.
    If these fail, it is likely a hardware problem.  You can call Apple to see about repair or look it up online:
    http://www.apple.com/support/ipod/service/faq/

  • Cannt communicate with my device (kind off)

    I have a Usb8451 and when I connect it , Measurement and Automotion  shows that it is in there, but when I would like to test it ( i believe its the first Icon when you browse to the device) its shaded and I cannot talk to it. The light on the DAQ is on and sometimes it flickers , but cant seem to properly talk to it. Another thing is how the heck can I set P0.0 on? WHats the difference between a port and a line?
    Thanks in adcance.

    Perhaps you could attach a screenshot of what you are seeing.  I have a USB-8451 (which is an I2C/SPI device, I want to verify that you are using this) on my machine, and I have attached a screenshot of what mine looks like in Measurement & Automation Explorer. 
    Cheers,
    Kelly R.
    Applications Engineer
    National Instruments

Maybe you are looking for