From two given tables, how do you fetch the values from two columns using values from one column(get values from col.A if col.A is not null and get values from col.B if col.A is null)?

From two given tables, how do you fetch the values from two columns using values from one column(get values from col.A if col.A is not null and get values from col.B if col.A is null)?

Hi,
Use NVL or COALESCE:
NVL (col_a, col_b)
Returns col_a if col_a is not NULL; otherwise, it returns col_b.
Col_a and col_b must have similar (if not identical) datatypes; for example, if col_a is a DATE, then col_b can be another DATE or it can be a TIMESTAMP, but it can't be a VARCHAR2.
For more about NVL and COALESCE, see the SQL Language manual: http://docs.oracle.com/cd/E11882_01/server.112/e26088/functions119.htm#sthref1310
I hope this answers your question.
If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and also post the results you want from that data.
Explain, using specific examples, how you get those results from that data.
Always say which version of Oracle you're using (e.g., 11.2.0.2.0).
See the forum FAQ: https://forums.oracle.com/message/9362002

Similar Messages

  • How do you fetch the URL corresponding to a particular ADRNR number?

    I have the address number ADRNR, I want the URL corresponding to the same.
    How do you fetch the URL corresponding to a particular ADRNR number?

    i suppose you want email address if so use this
    select adr6-addrnumber from table adr6 join table lfa1 with key adr6-addrnumber = lfa1-adrnr

  • U410 Windows 8 how do you split the screen in two?

    I have an IdeaPad U410 with Windows 8 as an Operating system. I would like to know how do you split the screen in two. Also I would like to know if I can put my screen as a touch?
    Moderator Note; subject edited for relevancy

    hi BoJ,
    Welcome to the Lenovo Forums.
    If you're referring to having an extended display , you will need to have an external monitor and enable extended mode by pressing the Winkey+P and select Extend.
    If you want to split the screen to work with 2 documents or 2 windows at a time, you can snap the windows by pressing Winkey+ Left or Right arrow - check this article in reference.
    Hope this helps
    Did someone help you today? Press the star on the left to thank them with a Kudo!
    If you find a post helpful and it answers your question, please mark it as an "Accepted Solution"! This will help the rest of the Community with similar issues identify the verified solution and benefit from it.
    Follow @LenovoForums on Twitter!

  • How do you merge the data of two MIDI regions?

    How do you merge the data of two MIDI regions into one MIDI region without using copy and paste functions in the piano roll editor?

    Sorry - didn't make myself clear. The glue tool would be no good here. I meant that I wanted, for example, to merge the MIDI contents of two regions that are perhaps on different tracks but play back at the same time, i.e. I want to add the 2nd region's MIDI to the 1st region's MIDI, but without having to go into the piano roll editor and cut and paste the data.

  • How do you sync the calendars between two ipads?

    How do you sync the calendars between two ipads?

    You can enable iCloud syncing on both devices, making sure hte calendar is part of the 'on' part and then what you change on one should change on the other too.

  • How can you utilise the 30 pin VGA adapter used on the iPad 3 and iPhone 4S on the iPad 4 which uses a lightning connector?

    How can you utilise the 30 pin VGA adapter used on the iPad 3 and iPhone 4S on the iPad 4 which uses a lightning connector?

    See the following. Also take note below and from the linked page above that video mode is NOT supported:
    http://store.apple.com/us/product/MD823ZM/A/lightning-to-30-pin-adapter
    *Note below and from the linked page above that video mode is NOT supported*
    "This adapter lets you connect devices with a Lightning connector to many of your 30-pin accessories.* Supports analog audio output, USB audio, as well as syncing and charging. Video output not supported."

  • HT3576 how do you stop the connect to itunes to use push notifications to stop poping up in my app it will not let me get into the app

    how do you stop the connect to itunes to use push notifications to stop poping up in my app it will not let me get into the app

    I have had this same issue but thankfully fixed it. Follow he steps below:
    Sync your iPhone with you iTunes therefore your info is backed up. Unplug your phone.
    Go to Settings > Reset > Erase All Content and Settings
    Once your phone has reset and come back on answer the question until it asks if you want to back up from itunes Click this then plug your phone in.
    After everything has sync'd back to your phone everything should work fine.
    Hope this helps.

  • How do you change the email address that was used to set up your ipod?

    How do you change the email address that was used to set up your ipod?

    Jus what do you want to accomplish? The Apple ID email address is used for variosu thing onthe iPod like:
    - For purchasing media. Srrings.iTunes and App stores. Sing out and sign into anoterh account
    - Settings>iCLoudl for iCloud account
    - Settings>FaceRome for Apple ID and where You can Be Reached At email address
    - Settings>Messages for Send And Receive email address.
    - Maybe for Game Center

  • How do you separate the iCloud on two iPads that use the same Apple ID

    How do you separate iCloud accounts for people using the same Apple ID

    You can share an AppleID between individuals for purchases from iTunes (music, movies, TV shows, books, etc.) while each having an individual iCloud account for syncing your personal calendar, contacts and iCloud files.
    In my household......
    We have a single AppleID for iTunes purchases which is used on all 8 of our iOS devics and 3 computers. That way all apps purchased from the Mac or iOS app stores or content from iTunes can be used on any device.
    Each of us (3 of us) then has our own iCloud account. None of our iCloud accounts are the same as the AppleID. The iCloud accounts are used for device backups, contact and calendar syncing, iCloud document files and photostream.
    This way, we all share apps and media, but our contacts and calendars are not mixed and neither are our documents. Each person having their own iCloud account also helps with space when dealing with device backups.

  • How do you configure the set of port to use for FTP passive data connection

    I was able to start the ftp server xml db and connect to it locally. When I tried to connect to it from home, I was able to log in but when i do a "get" command the sessions hangs. I also tried passive mode and do a "get" command and it gives me a connection refused error. I am using the default port 2100. I think this might be a firewall issue with the data connection port. I am not sure which range of ports to open for the passive ftp connection on the server side or where to go and set them for for the ftp server to use? Or this issue might not be firewall related??? Any thoughts. Thanks.

    This is a typical problem with VPN/Firewall software and FTP on ports other than 21.
    When you open the FTP data connection the FTP Server identifies which port the data will be sent on using the PORT command which is sent on the command port (typically 21 with a normal FTP server, 2100 by default with XDB). THe client then opens that PORT to accept the data (file, output of an ls etc).
    As I understand it most VPN/Firewall are configured to monitor 21 for 'PORT' requests. They then understand to allow connection on the PORT number passed on the command PORT. Hence with Port 21 firewall / VPN software is not a problem. However since the XDB command PORT is something other than 21 they do not see / honour the PORT commands from the server and hence the client cannot open the data connection on the specified PORT
    As to how to solve it, I wish I knew (After 5 years I still can't use XDB FTP from home to a machine in the office once the VPN tunnel is open :( ). I'm sure it's going to be firewall / VPN software specific and may need the VPN servers to be configured.
    The best bet would be to run the FTP server on 21...
    Add the following line to your listener.ora file
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP) (HOST = hostname) (PORT = 21))
    (PROTOCOL_STACK = (PRESENTATION = FTP) (SESSION = RAW)))
    and then restart the listener as root
    Start the listener as root.
    At the operating system prompt, enter tnslsnr with optional command line arguments. The usage is as follows:
    tnslsnr [listener_name] [-user user] [-group group]
    where:
    Table 4-3 tnslsnr Utility Options
    Option Description
    listener_name
    Specify the name of the listener. If omitted, the default name LISTENER will be used.
    -user user
    Specify the user whose privileges the listener will use when super user (root) privileges are not needed. After performing the privileged operations, the listener will give up root privileges irreversibly.
    -group group
    Specify the group whose privileges the listener will use when super user (root) group privileges are not needed. After performing the privileged operations, the listener will give up root group privileges irreversibly.
    The listener will temporarily switch to the provided user and group immediately after startup. All subsequent operations will be done with the specified user and group privileges, except the system calls necessary to listen on configured endpoints. The listener will revert to super user (root) for a short period of time to listen on reserved addresses, such as TCP ports less than 1024. After the listener starts listening on all of its endpoints configured in listener.ora, it will switch to the specified user and group irreversibly. Therefore, the listener will give up the root privilege that it initially had. In the current release, -user and -group command line arguments only accept user and group identifiers specified in numeric form.
    For example, to execute a root listener called mylsnr and have it use privileges of a user identified

  • How do you make the Filter so we can use the FIM cmdlets to list Users who have no Manager attribute

    I can easily create a Set of Users who are "unusual"
    The SET criteria is
    EmployeeID starts with %
    and Any of
        EmployeeStatus not starts with %
        EmployeeType not starts with %
        Manager not in All FIM users
    This criteria works and gives me all the users when I push the View Members button.
    But when I look at the Set's Filter it seems to refer to a uuid of that All FIM users Set. To be honest I dont fully understand the set's XPATH filter.
    What I hope to do is to some how build a filter so that the FIM cmdlets can be used to identify and fix up these users, especially those who do not have a valid Manager. There are hundreds of these non-standard users and although possible, its not practical
    to do this by hand via the "All Non Standard Users" set.
    Any hints welcomed.

    All users without a manager: Xpath Filters
    /Person[not(Manager=/Person)]
    or,
    /Person[Manager!=/Set[DisplayName='All People']/ComputedMember]
    <# Please do not anything in the production environment unless and until you are very much sure #>
    # Powershell Cmdlet to find all users in portal not having manager
    # Load FIMAutomation module
     if(@(Get-PSSnapin | ? { $_.Name -eq "FIMAutomation" } ).Count -eq 0)
         Add-PSSnapin FIMAutomation;
    $users = Export-FIMConfig -customConfig "/Person[not(Manager=/Person)]" -Uri "http://localhost:5725"  -OnlyBaseResources
    foreach ($user in $users)
    $x = (($user.ResourceManagementObject.ResourceManagementAttributes | Where-Object {$_.AttributeName -eq "DisplayName"}).Value) 
    Write-Host "$x"
    Thanks and regards,
    Anirban Singha(Bangalore)

  • HT3275 How do you Format the external hard drive been used for time machine?

    Error reads "Not enough space on the external hard drive" How do i format the memory and start again?
    Thanks Geremy

    ON an external hard drive.. that is easy.. just open disk utility and reformat it. Make sure you use Mac Extended Journeled. (HFS+)

  • How do you set up multiple users? Netscape use to let me choose which profile to start. Can I do this with Firefox and can I have email linked to each individual user/login? How?

    Netscape use to let me choose and create new profiles. after clicking on the icon for netscape i was prompted for which user profile i wanted. can i do this with firefox? also, each user profile was linked with its respective email account. can i do this through firefox as well? I need help. i have tried setting up firefox before and since i couldn't accomplish this i had given up but netscape is so old and most sites cause it to crash, i need a solution. i have 2 main profiles and 2 different email addresses. any advice or help, even not firefox related would be great

    Firefox doesn't have the same type of interface for the Profile Manager that Netscape did. You might want to look at SeaMonkey ''(which uses the same Mozilla Gecko code as Firefox has)''.
    http://www.seamonkey-project.org/

  • How do you stop the welcome to firefox 4 screen from coming up every time I open firefox? I get two tabs, one the welcome window, then my home page. How do you stop the bloody welcome screen?

    How do you stop the welcome to firefox 4 screen from coming up every time I open firefox? I get two tabs, one the welcome window, then my home page. How do you stop the bloody welcome screen?

    Its not my home page, Like I said, I hae my home page also come up in a different tab (google) I also get the welcome to FF4 on a seperate tab. My home page is set to google. But I dont want the welcome screen to pop up

  • Union two tables with diffrent count of fields with null and float value

    Hello,
    i want to union two tables, first one with 3 fields and second one with 4 fields (diffrent count of fields).
    I can add null value at end of first select but it does not work with float values in second table. Value form second table is convert to integer.
    For example:
    select null v1 from sessions
    union
    select 0.05 v1 from sessions
    result is set of null and 0 value.
    As workaround i can type:
    select null+0.0 v1 from sessions
    union
    select 0.05 v1 from sessions
    or simple change select's order.
    Is any better/proper way to do this? Can I somehow set float field type in first select?
    Best regards,
    Lukasz.
    WIN XP, MAXDB 7.6.03

    Hi Lukasz,
    in a UNION statement the first statement defines the structure (number, names and types of fields) of the resultset.
    Therefore you have to define a FLOAT field in the first SELECT statement in order to avoid conversion to VARCHAR.
    Be aware that NULL and 0.0 are not the same thus NULL+0.0 does not equal NULL.
    In fact NULL cannot equal to any number or character value at all.
    BTW: you may want to use UNION ALL to avoid the search and removal of duplicates - looks like your datasets won't contain duplicates anyhow...
    Regards,
    Lars

Maybe you are looking for