Display 0 if there is no data for that corresponding match

Suppose we have an employee table with columns employee_id and first_name. In case there is no matching data, the result should display zero.
EXAMPLE:
Employee_ID               FIRST_NAME
============================
10                               Harry
20                               Larry
select employee_id from employees
where first_name='Jack';
This will return an exception NO_DATA_FOUND, but I want to show 0. Is this possible?

adfSonal wrote:
Suppose we have an employee table with columns employee_id and first_name. In case there is no matching data, the result should display zero.
EXAMPLE:
Employee_ID               FIRST_NAME
============================
10                               Harry
20                               Larry
select employee_id from employees
where first_name='Jack';
This will return an exception NO_DATA_FOUND, but I want to show 0. Is this possible?
So many unanswered questions, this is really really hard to answer.
If you are trying to do it in SQL, we can provide 1 answer.
If you are trying to do it in PL/SQL, you may get a completely different answer.
What column(s) do you want to show 0 for? All of them? one of them?
Please be specific.
More information is better.
The simplest way is probably:
select NVL(e.emp_id, xx.emp_id), NVL(e.first_name, xx.first_name) first_name
  from employees e
       FULL OUTER JOIN
       (select 0 emp_id, null first_name from dual ) xx
      ON xx.emp_id = e.emp_id;

Similar Messages

  • How Do I - Display a group when there is no data for the group?

    I have a report where I'm grouping on a numeric county number. Currently, if there are no records for that county, that report group doesn't display. My users want each county printed even if it has no data.
    The numeric values for county range from 1 - 85. I'm using CR 11.5 and pulling data from a Teradata database.

    Hi. I had already thought of doing an outer join on the county column of the county look up table. The problem is that this transfers the selecting and counting of the targeted data from the SQL statement to the report, specifically most of the formula fields itself. And given that the report is parameter driven, it would make maintenance of the report not so much fun. The solution ( I think, still have to code it) is to take my original inner join query and UNION it to a query selecting only the county column from the county look up table. I just add null valued columns to match the number of columns in the original query. This way I get at least one county record to satisfy the display of each group and only minimally increase the actual number of records the report has to process.

  • Is there a release date for Apple pay in australia

    IS there a release date for Apple pay in Australia

    The SQL Developer team have always run a series of early adopter releases before the production release as we have found the community really get involved in these, which is of course benficial for everyone. We plan to do the same for the next release and will announce any early adopter releases here on the forum.
    We will be demonstrating features at Oracle OpenWorld, but you may recall that SQL Developer 2.1 was not production for that last year, so we have a lot to show.
    Unfortunately we are bound by Oracle policy and may not release any dates.
    Regards
    Sue

  • Is there a retirement date for the CS6 certification exams?

    Is there a retirement date for the Adobe Photoshop CS6, Indesign CS6 & Illustrator CS6 exams? If so, when will Adobe retire these exams?(Not the recertification exams. I don't have any previous certification with Adobe.)

    Looking to write the exam sometime during the next two years. Yes, I know the subjects are about a month long but will be working and can't study everyday. Most likely will only do two to three chapters a month.(my work is that hectic).
    Hope they won't retire it any time soon! I know updates comes out every year. just have to take my chances.
    If anybody else knows of anything please rely.

  • If there is no data for a specific row, please don't show the row at all.

    Hi,
    If there is no data for a specific row, please don't show the row at all.
    how can this be done??
    Thanks in advance.

    Not clear no data for row?
    Did you try with Pivot table? that should take care of it.
    Let us know updates

  • HT4890 how do i view photos from icloud on my PC, there is no icon for that purpose

    how do i view photos from icloud on my PC, there is no icon for that purpose

    If you have Outlook 2007 or higher on your PC, you can print your iCloud calendar from within Outlook.  If you don't, and are accessing it on icloud.com, about all you can do is take a screenshot using your print screen key and print the image.

  • HT4914 how do i Download my entire collection from iTunes Match, There is an option for that or do i have to download each album separately?

    i want to Download my entire collection from iTunes Match with just One click, Or somenthing like that, but i don't know if there is an option for that or if i have to download every album one by one

    Welcome to the Apple Community.
    Select all your content in iTunes and choose download from the contextual menu that appears when you ctrl-click on your selection.

  • Display columns when there is no data to display

    hello,
     Quick question,
      I would like to display a portion of report where there is data or no data
      There is data subreport  display   
         Product Name Latex Gloves  
         Product ID      
    xxxx5678
     There NO data in the subReport
      Product Name                          
       Product ID                              

    Hi xitum,
    Per my understanding that you want to display the column name and the values in the style you have provided, right?
    I have tested on my local environment and you can achieve this by type the column names on the left of the values field and then add an "Underline" for the values field.
    Details information in steps below for your reference:
    Type the column name"DateKey" on the left of the [DateKey] and then double click the [DateKey] you will open the "PlaceHolder Properties" windows like below:
    Click the Font section and under the "Effect", choose the "Underline" this will add an underline under the values.
    Click the General section in the "PlaceHolder Properties" windows and add the expression like below to make sure if there is no data in the column values there is also display the underline( by default, if there is no data, t he underline will
    not display):
    =IIF(Fields!DateKey.Value="" or Fields!DateKey.Value is nothing,"               ",Fields!DateKey.Value)
    If you still have any problem, please feel free to ask.
    Regards,
    Vicky Liu
    If you have any feedback on our support, please click
    here.
    Vicky Liu
    TechNet Community Support

  • Is there a projected date for Canon G7 x?

    Is there a projected date when cr2 files from the canon 7G X will be readable?

    It is on our radar and hoping to add it in an upcoming update.
    As soon as it is available, it will be updated in the below article. Camera Raw plug-in | Supported cameras
    ~ Arpit

  • Premiere CS6 not supporting AVC-G25/50P will there be an update for that?

    Good morning Adobe,
    I own a Panasonic AJ-PX270 with the P2 content format. I filmed using the AVC-G25/50P format, but that is not supported when i want to import the file structure into my Premiere CS6 it gives me a standard error.
    Does anyone know what file format i have to use in my sequence to get this imported?
    Will there be an update for this?
    I have also asked Panasonic to provide me a solution, haven't heard from them.
    Perhaps someone knows how i can convert the files into another file format outside of premiere?
    thank you very much!
    Ruud van den Einden

    Yes, it's Java update 16 for Mac OS 10.6 that broke lots of stuff.  The 51 comes from it updating Java to 1.6_51.  There is an update to the update for 10.7 and up posted, but is there one for 10.6?
    UPDATE:  Never mind.  If you go to the download page for Java update 16, it appears that it has been silently updated.  Although there isn't any indication of the fact that it has been fixed, the build number is different (20.51-b01-457 instead of -456).

  • Date display setup - is there configuration file option for this?

    I have just installed SQL Developer and am loving it BUT since I am a long time SQL*Navigator user, one thing floored me.
    In SQL*Navigator, there is preference you can set that will display all dates in the format you want, I don't see that option here in SQL*Developer. It is defaulting to yy-mm-dd. I understand I can alter my session or use a to_char function to get the date in the format I want, but isn't there a configuration file somewhere or preference I can set to the date/time format I would like to display each time I use SQL*Developer???????

    Oracok, there is no way to do this in SQL Developer according to the oracle.com website:
    http://www.oracle.com/technology/products/database/sql_developer/howtos/howto_policy_date_formats.html
    As for wanting to be able to do this - Seconded. I would love it if there was an equivalent to the SQL*Plus glogin.sql that could be run every time SQL Developer opened.
    -Natalka
    http://toolkit.rdbms-insight.com

  • This is for Verizon Customer Service: Is there an estimated date for the 8.1 Denim update for Windows Phones?

    Will Cyan be rolled out for the Icon, or should we expect to wait until Denim is supposed to be rolled out around October
    << Moderation discussion removed to comply with Verizon Wireless Terms of Service >>  This is a very specific question and Verizon Customer Service can't answer it if they don't have a chance to read the question.
    I spoke with Microsoft Customer service, and the agent specifically said MS already pushed Cyan to Verizon, and he, as a WP owner on Verizon, was also frustrated that the updates haven't been rolled out by VZW.
    So bottom line question: Skipping Cyan? If so, what is the Denim date?
    Message was edited by: Verizon Moderator

    Unfortunately the answer is unknown.  The majority of the Windows phone threads here are about this exact subject, and that says a lot about Verizon and their ability to communicate on a basic level.  You might get your update, you may not.  Verizon is in control and doesn't really care.

  • Is there an expiration date for MAC OSX Snow Leopard 10.6.3

    Just wondering how much longer I will have access to programs on my MacBook.

    There's no definite time limit. The programs on the computer will continue to work, but as time goes on, fewer updates will be available for them, and if they interface with websites, those sites might be closed(such as MobileMe) or upgraded to incompatible versions.
    (97155)

  • List all dates in date range even if there is no record for that day

    Hi,
    I have a really simple report but am having a problem with dates.
    I want to list sales per day over a date range (start date and end date parameters).
    The data i am working with may not have sales on every day which is causing grief with my average calculations.
    I need to capture days in current month which i have with DateDiff ("d", {?Start Date}, {?End Date}+1)
    Then days elapsed in the month. This is where my problem is. I have grouped my data by day to get day totals, and have then attempted to use a summary on DISTINCT COUNT to get the result i need. The problem is it only counts the lines that are there, so if a day has no sales it is skipped and the count is incorrect and then the average calculations i have are not correct.
    Help will be much appreciated.

    YOu can not create data that does not exist.
    You will need to add in a table which has all dates and make that you first table with all other data joined with a left out from this date table.
    Ian

  • Is there a release date for the 27" imac?

    Does anyone have an idea when it is being released or even a pre-order date.
    My local apple store had no idea but the chap there didn't seem to interested. Just shrugged his shoulders and walked off.

    Apple has stated that it will be available in December. That is all that anyone here knows.

Maybe you are looking for

  • For Outlook 2011 for mac while relying outlook hanging problem

    Pl let me know the solution for given below problem While replying to my emails some times it works fine but most of the times my screen hangs I m not able to type anything on it. It shows very thin (light) line on left side. When I create a new emai

  • Creation of condition record (MEK1) for freight w.r.t. vendor in STO

    I am working in ECC 6.0 environment. My requirement is to fetch value of freight automatically w.r.t. selected vendor in condition while creation of STO. How can i define condition record by MEK1 for the same? Which access sequence needs to be assign

  • Tiny Victory? Check my work...

    I'm trying to understand the code in my site, and make a few small adjustments, without having to run to the developer each time. Frankly, the  code on my site is way above my level of experience. But I am trying to slowly understand what each of the

  • Automatic clearing in F-22

    We have cancelled invoice and this is knocked off against the original invoice in F-22. Is there any configuration available so that the cancelled amount is

  • Currency & Unit creation in Cube

    Hi, Could anyone guide me the Steps for using of currency field from start to end in BI 7.0. Am trying with a small example where keyfields contains a currency or unit infobject. a) created infoobject with Quantity field as Unit and Price as Currency