return zero when no data available

Hello.


In PL/SQL, sql next causes an error when there is no record that matches the search criteria:


-----
Select pin_number from table1 where id = 1;
-----

error: no data available


Is there a way to get a return value 0 whenever there is no matching record?


Any suggestions are greatly appreciated.

Use exception NO_DATA_FOUND...

Read FAQ: {message identifier: = 9360013}

You can also use MAX based on your requirement... What do you do, if there are multiple records ID? Based on that you can use as

select nvl(max(pin_number),0) from table1 where id = 1;

Tags: Database

Similar Questions

  • Table of index always returns zero when reading the table 3D

    I have a 9 x 2000 x 5 table table 3D diamension.  I have this table filled with data and when I try to read a data point unique on the table the function Index Array always reads zero. I place a probe on the 3D input array and when I put in the index of the probe to the same data point the probe shows the value stored in the table. I also have an indicator showing the 3D table and it displays data in all locations. For example if I try to read the location 0, 144.0 in 3D it array always return zero. Yet I know that the value of this element is 6.8616E - 5. Each item I try to retreave table gives zero.

    Anyone saw the Index room table this kind of behavior?

    Problem solved. As usual, it was pilot error on my part had knocked down the lines of lines and columns.

  • XML query returns empty when tags no data

    Hi all

    I have a problem that I can't solve.

    I have the following query:
     select
                xmlelement
                (
                   "users",
                   xmlagg
                   (
                      xmlelement
                      (
                         "user",
                         xmlelement
                         (
                            "username",
                            e.pin
                         ),
                         xmlagg
                         (
                            xmlelement
                            (
                               "details",
                               xmlforest
                               (
                                  e.password as "password"
                                 ,e.first_name as "forename"
                                 ,e.surname as "surname"
                                 ,'0' as "retired"
                                 ,e.email_address as "email"
                                 ,e.telephone_number as "phone"
                                 ,'No External Ref' as "externalRef"
                                 ,add_months(sysdate,+60) as "expiryDate"
                               )
                            )
                         )
                      )
                   )
                ) xml_out
             from   aqaost_examiners e
             group by e.pin;
    The query returns the XML code in the desired structure.

    But the problem I have is that when there is no data found by the query, I always get a single row returned by the following: < user > < / users >

    I tried so many things to try to have the query return nothing if there is no data available, but I can't do without something else goes wrong (to mess up the XML structure, etc.).

    Please is - can anyone help or point me in the right direction?

    I thank very you much in advance!

    Robin

    Hello

    Peter,

    This is the GROUP that does this.

    Actually no, the GROUP BY refers to the deepest XMLAgg and is required if e.pin is not unique.

    Let it out, and you also seem to have of many XMLAGG (?)

    That's assuming that e.pin is unique within the table (which is probably a fair assumption in this case).

    In fact, the behavior comes from the XMLAgg in the foreground:

    SQL> select xmlelement("users",
      2           xmlagg(
      3             xmlelement("user",
      4               xmlelement("username", e.empno)
      5             , xmlelement("details",
      6                 xmlforest(
      7                   e.ename as "name"
      8                 , e.job as "job"
      9                 )
     10               )
     11             )
     12           )
     13         ) xml_out
     14  from scott.emp e
     15  where 1 = 0
     16  ;
    
    XML_OUT
    -------------------------------------
    
     
    

    As with other global functions (such as SUM or AVG) adding a GROUP OF 'something' solves the problem:

    SQL> select xmlelement("users",
      2           xmlagg(
      3             xmlelement("user",
      4               xmlelement("username", e.empno)
      5             , xmlelement("details",
      6                 xmlforest(
      7                   e.ename as "name"
      8                 , e.job as "job"
      9                 )
     10               )
     11             )
     12           )
     13         ) xml_out
     14  from scott.emp e
     15  where 1 = 0
     16  group by null
     17  ;
    
    no rows selected
    

    Robin,
    So the more intimate XMLAgg is really necessary, you can use a subquery:

    select xmlelement("users", v.users)
    from (
      select xmlagg(
               xmlelement("user",
                 xmlelement("username", e.empno)
               , xmlagg(
                   xmlelement("details",
                     xmlforest(
                       e.ename as "name"
                     , e.job as "job"
                     )
                   )
                 )
               )
             ) as users
      from scott.emp e
      group by e.empno
    ) v
    where v.users is not null
    ;
    
  • I would like to ask how can I do a massage of automatic return, I'm currently not available when vecation, travel bussines... Thank you

    I would like to ask how can I do a massage of automatic return, I'm currently not available when vecation, travel bussines... Thank you

    If this fix your problem, please mark the thread as "solved" Please?
    Thank you.

  • BEEP graphical report shows zero when data are missing in EBS instead of null

    Hello

    I have a rtf model and an xml data file. When I generate the release, beep desktop tool, the graph shows the value as null as expected. But the same thing when I try to preview the output in xml editor responsibility in ebs, null values are shown as a zero in the graph.

    Download the rtf, xml and the release of the desktop ebs and beep tool.

    Please advise on how to display the value null when the data aren't there in a graphic that is in the rtf model in EBS.

    Note: The issue happens with all types of output

    Kind regards

    Diakite

    The BSE file is secure so I don't see the version,

    but probably you are on a version lower than desktop computer (10.1.3.4.1).

    The instance of the EBS is probably running into something similar to this:

    Bug 18270934 : PUBLISHER PRINTS NULL VALUES such as ZERO IN a TABLE

    Kevin

  • Functions of DLL Labview only each returns 0 when it is called in C

    Hey guys. I'm having a problem using a dll built in labview in my code C. I did a labview program that read the current analog signals 7 analog pins and them stored in a table. Then I have a variable that corresponds to the index that you want to localize (whenever the function is called I don't read only one current value of the table) and then put this value into a digital indicator that is the result I want.

    It has worked well in labview, but after I generate a DLL to it and call the function in my c code it always returns 0 instead of reading of the axis. Even when I put constant values in the table, when I call the function I always get 0. I also did a labview program who just returned a constant number by pressing, and when I built as a DLL and calls the function in my C code it issued yet only 0.

    I am very confused how this happens. I have connected the digital indicator to the connector and component when I build the DLL it claims that I'm a function that is:

    Double Test1 (double Index)

    Where "double index" is the index of the table that I want to read, and the return value is the digital indicator that contains the value at this level.

    I call the funcition in my C code as follows:

    #include "SharedLib.h" //This is the header for the DLL file. I also include .lib, .dll, .ini, and .alias files
    #pragma how (lib, "SharedLib.lib")

    Double i = 0;   just for an example, I'm access at index 0 of the table, which I set to a constant value

    values = Test1 (i);  It will always return 0, regardless of what the index is

    I guess my big question is how is it possible to get the labview function built DLL to run C code but only eery return 0? I can show you all my Labview code, but as I tried several functions to try to get a value not zero to not think availI miss me something else which isn't regardng real labview code. Thank you very much!

    Indexing by a double seems to be ok in Labview. I understand the problem however. The labview functions actually worked, I was just incorrect printing. I was really stupid and my printf statement was printf ("%d", value) printf ("% lf, value) which is what you need for the double rooms, and he did print always 0. Thanks for your help though guys.

  • How to hide a chart when no data

    Hello

    I have a chart in my rtf model. I extract data from db with the sql query.
    I want to hide this model when there is no data (means sql query returns zero results). Can someone let me know how can I achieve this?

    Thank you
    -Vijay-

    Check if the widget is based on exist or check for account of this item as 0? >

  • My MacBook is not connect to my Time Capsule to back up.  IMac my wife backup fine and our wifi works, but when I try to save, I get a message telling me to connect to the T. C. when it is available, which is never.  Help

    My MacBook Pro is not connect to my Time Capsule so it backs up.  IMac my wife backup fine and our wifi works, but when I try to save, I get a message telling me to connect to the T. C. when it is available, which is never.

    The problem started when I upgraded to Yosemite, sometimes back.  I am running 10.10.5.

    The MacBook Pro...

    Click the 'clock' Time machine at the top of the screen of the Mac

    Click Open Time Machine Preferences

    Click Add or remove from your drive

    Under the heading of backup disks, click on the drive it to highlight (probably named 'Data', unless you have changed the name of the drive)

    Click remove disk

    Close the windows

    Restart the MacBook Pro

    Click the 'clock' Time machine at the top of the screen of the Mac

    Click Open Time Machine Preferences

    Click select drive or Add or remove disks

    Choose the Time Capsule drive (probably named 'Data') by highlighting

    Click use the disk

    Close the windows

    Wait a while to see if a backup is performed

    If you want to manually run the backup, click on the Time Machine clock icon, and then click Backup now

    Report on your results. If the backup still does not work, we need the exact message that you see there.

  • ? Primary Master Hard Disk S.M.A.R.T. Bad Status. WARNING: Return immediately-up your data and replace your hard drive.

    When I start my computer, an error page appears. At the bottom of the page it says, "Primary Master Hard Disk S.M.A.R.T. Status Bad." WARNING: Return immediately-up your data and replace your hard drive. Press F1 for Setup, F2 to continue"I was just pressing F2 and then it starts normally, but whenever I start my computer, the same page comes up.

    Is this serious or it could be something minor? Do you have any suggestions? What does that mean? What should I do? I followed some information in the forums of someone who has had the same problem and finally, they fixed them, they said that when they made a prior microsoft update what they where missing a Parcer.

    Note: I tried to save my data before, but something goes wrong and the backup will not be completed.

    You can download the program for diagnotics HUtil Samsung http://www.samsung.com/global/business/hdd/support/downloads/Hutil210_iso_for_CDROM_drive.zip

    It's an ISO image then unzip the file and write the ISO image to a CD.

    Then restart the PC and booting with the CD. To do this, you must change the priority/boot order in the BIOS to boot from the CD first.

    Once you have started the program HUtil it will detect your hard drive Samsung. Select the hard disk.

    Enter the main Menu on the tool. Go into the menu of the tool and enter Auto diagnosis. Enable diagnostics to run, once done it will ask you if you want to perform a surface analysis - enter Yes. The analysis of surface will take some time to complete. If errors are found, it reported.

    Once more I recommend you backup your data as soon as possible, preferably before executing HUtil program.

    For more information on the program of HUtil you can go here: http://www.samsung.com/global/business/hdd/support/utilities/Support_HUTIL.html

    Write when the cache is enabled: when data are written back to the hard drive, it is written in the cache that is much faster to actually write to the hard drive. An acknowledgement of receipt is then sent by saying that the data has been written on the hard disk, when in fact it does not. In this way so that the data is actually being written to the hard drive to the rest of the system can continue to work. However memory cache is volatile, if the power goes off, the data in the cache is destroyed and if it has not been written to disk hard and yet he's lost.

    If your settings are correct. Usually the drives are configured for performance and the write cache is enabled. While flash drives and memory cards are configured for the fast-moving and write cache is disabled.

    If you want to learn more about this: http://www.pcguide.com/ref/hdd/op/cacheWrite-c.html

  • Media Center Guide 'no data available '.

    I noticed that every now and then I see "No Data available" for some channels in the guide. Its random when it happens and what channels show it. The only way that I can't bring back data is to go in the guide editor and make a small change and keep the guide. After recording, the guide is complete again. After a week or two, the same problem is back. Could be timed with the release of the automatic guide.

    The channales than what is happening on are on my list dishnetwork.

    Thoughts?

    Hello NerdBrick,

    Thank you for using Microsoft Vista answers Forum!

    Here are a few possible reasons why you may have this problem with Windows Media Center

    ·         Media Center was unable to download the new registrations.

    ·         Data are not available for your Microsoft TV Listings service provider location.

    ·         Media Center has identified existing data on your computer to be outdated or damaged.

    For more information and how to resolve this problem, follow the guide step by step in the link below

    There is no data available in the Guide

    If please reply and let us know if your problem is resolved or if you need more help.

    David O
    Microsoft Answers Support Engineer
    Visit our and tell us what you think.

  • Vista Ultimate 64 Media Center Guide showing now "No Data available" on all THE TRACKS!

    At Microsoft, Please will someone give me a solution to this? I see other users having the same problems, but none of the solutions have worked on my system.

    Problem: The guide in my Vista Ultimate 64 Media Center went to the indication "No Data available" on two large local stations to show on all THE stations, making it unusable guide and the Media Center unprogrammable.
    The Media Center and the Guide were great features and additions to my ATSC OTA television until mid-June, when this two station (and their substrings) launches it first stood. Now it's total.

    I downloaded both MCETVPack Windows6. 0-KB966315-x 64.msu and Windows6. 0-KB967632-x 64.msu , but the TWO open a dialog box reading "this update does not apply to your system."

    I tried to configure my TV options in Media Center repeatedly, but this does not change a thing.

    Please give me a solution that works with my system.

    Hi John Pendleton.

    Please check that the updates of windows are installed on the computer, including service packs.

    I would like for you to try the following steps as well:

    Go to the media guide and select the channel that you have a problem with.

    Make sure that you can recover the programs before performing this procedure, because if you cannot receive the programs you won't have the registration guide either.

    Open the Program Guide and navigate the Canal problem.  Right click on the channel of the problem and choose settings.  Then click TV, click Guide, and then add announces to the channel, click the channel of problem and change to one of the channels below the list (for example, 4Music).

    Click Save button. Now click on the channel you selected (for example 4Music) and repeat the procedure but cela suite scroll delay to find the channel of problem.

    Click on save and go on the media guide and registration should now appear.   If this is successful, you will need to perform this procedure for the other channels as well.  Check if the guide works correctly.  Let us know the results in your response.

    I hope this information is useful.

    Concerning

    Rehman - Microsoft Support

  • Import contacts with congestion 2.0 API fails and WARNING: "there is no data available to treat."

    I try to send AppCloud Action instance data with the results of my server.

    Since last Sunday (07/12/14) I get jobs with the warning from the State, the message is: there is no data available for the process, eloqua status code: ELQ-00124

    The weird part is that sometimes when I try again with the same data, it works.

    I don't know what am I doing wrong. Here is an example for creating a job:

    First request to create the import definition

    URL:

    https://www02.secure.Eloqua.com/API/bulk/2.0//contacts/imports

    body:

    {"syncActions": [{'action': 'setStatus', 'status': 'complete', 'destination': ' {{ActionInstance(1111111111example-instanceid111111)} ""} '}], 'isSyncTriggeredOnImport': 'true', 'name': "My App", 'identifierFieldName': 'C_EmailAddress', 'updateRule': 'ifExistingIsNull', 'fields': {'C_EmailAddress': "{{Contact.Field (C_EmailAddress)}}"}}

    Second request for data push

    URL:

    https://www02.secure.Eloqua.com/API/bulk/2.0///contacts/imports/4946/data

    body:

    [{"C_EmailAddress": "[email protected]" ""}, {"C_EmailAddress" ":" "[email protected]"}]

    Any help would be appreciated

    Thank you.

    Hello

    Do you use 1 import definition and perform several data grows at the same time (compared to 1 import a definition for each data push)?  If you do the former, try this approach.  As the definition of import isSyncTriggeredOnImport = true, Eloqua immediately commits the data downloaded to the database; However if you have a later thrust at the same definition of import, the 2nd push data can be engaged with the sync 1, so when Eloqua attempts to synchronize the data of the 2nd time there may be "no data".

    Having said that, without really understanding your data, that it'll be difficult to nail the cause root here.  If you are a customer you can join My Oracle Support so that they can help to study at a lower level.

    See you soon,.

    Brigitte

  • All 6.2.1 vRO dashboard charts don't show 'no data available '.

    Hello-

    I'm not entirely sure when this started happening, but the other day I went to watch a heatmap of data store in the dashboard of data store and the chart area normal just showed a gray window with "No data available" printed on it.  I thought maybe it was my collector, but everything went well with it.  I moved and re-created in any case, going so far as to do a second time, but allowing him to remove all previous data, still no luck.  So I changed it on behalf of [email protected], but that made no difference, I was using a service account for data collection.  I tried upgrading to the latest version and vRO, 6.2.1.3774215 and gave a few weeks ago, but still nothing.  All my other data seem to collect and works fine, including regular health alerts or warnings from the anomaly.  Health, risk and badges of efficiency that seem to be all very well for production, it is only the tables in the dashboard and the widgets that appear to be broken, and it does for all of VM hosts to data warehouses.  Anyone has any ideas, or suggestions on where I could go to investigate further?  Thank you.

    My idea is that you must change the dashboard and re - manually select the objects you want to monitor.

    I had a similar problem if I remember correctly and that is reproducible only after an upgrade. So, go into dashboards that show any info and click on the pencil icon to edit and check if an object is selected at all; If you don't mind attach or incorporate a screenshot with defective dashboards.

    Best regards

  • When exporting data to essbase with L0 members, shared members are also get exported.

    Hi, when exporting data to essbase with L0 members, shared members are also get exported.

    But I don't want to export another hierarchy!

    Example:

    project

    XYZ +.

    ABCD +.

    P00001 +.

    p00002 +.

    GFE +.

    p00003 +.

    p00004 +.

    all the xyz (Label only)

    ABCD (shared member)

    EFG (shared member)

    I want data to be exported only with P00001, 2, 3, 4.

    I think that the OP cannot use Level0 in DATAEXPORTOPTIONS, because not all dimensions are zero-level.

    Cameron, thanks - Yes, it's the behavior of the OP is seen (and disliking).  The share of 'level zero' which is in fact not level zero (in the primary hierarchy) is included in the output.  I think it's the problem rather than replication / repetition.

  • I want to just state change when the data set are called in GridItemRenderer

    I have a GridItemRenderer here, however when the user mouse over it the States returns to criticism, I want only state change when the data value is called

    <? XML version = "1.0" encoding = "utf-8"? >

    " < = xmlns:fx s:GridItemRenderer ' http://ns.Adobe.com/MXML/2009 "

    xmlns:s = "library://ns.adobe.com/flex/spark".

    xmlns:MX = "library://ns.adobe.com/flex/mx".

    clipAndEnableScrolling = 'true' currentState 'critical' = >

    < fx:Script >

    <! [CDATA]

    import of utils. UsefulConstants;

    override public function set data(value:Object):void

    {

    Super.Data = value;

    put the text in red to indicate the old value

    {if (Data)}

    {if (!) Data.dateAcknowledged)}

    this.currentState = "critical";

    }

    ElseIf (data.dateReceived.time - data.dateReceived.time > UsefulConstants.oneDay) {}

    this.currentState = "warning";

    }

    ElseIf (data.dateReceived.time - data.dateReceived.time < UsefulConstants.oneDay) {}

    this.currentState = 'safe '.

    }

    Else if (data.status == 'CLOSED') {}

    this.currentState = 'safe '.

    }

    else {}

    throw new Error ("unexpected conditions for data.dateReceived.time - data.dateReceived.time'");

    }

    }

    }

    []] >

    < / fx:Script >

    < s: states >

    < name s: State = "critical" / >

    < name s: State = "WARNING" / >

    < name s: State = "safe" / >

    < / s: states >

    < s:HGroup x = "-1" y = "-1" width = "100%" horizontalAlign = "center" verticalAlign = "middle" height = "100%" >

    < s:Graphic id = "icon" includeIn = "criticism, warning" x = "-1" = "5" width = "16" height = "20".

    version = "2.0" viewHeight = "600" viewWidth = "200" >

    < s:Ellipse width = "88" height = "401" = "58" x y = "37" >

    < s:fill >

    < s:SolidColor alpha = "1" color = "#FE4744".

    Color.Warning = "#Ff7f45" / >

    < / s:fill >

    < s:stroke >

    < s:SolidColorStroke color = "#FE3D44" alpha = weight '1' = '1' / >

    < / s:stroke >

    < / s:Ellipse >

    < s:Ellipse width = "51" height = '97' x '79' = y = '478' >

    < s:fill >

    < s:SolidColor alpha = "1" color = "#FD8E9E".

    Color.Warning = "#f69240" / >

    < / s:fill >

    < s:stroke >

    < s:SolidColorStroke color = "#942EC8" alpha = "0.62" / >

    < / s:stroke >

    < / s:Ellipse >

    < s:Ellipse width = "31" height = "147" x = "72" y = "122" >

    < s:fill >

    < s:SolidColor alpha = "1" color = "#FD8E9E".

    Color.Warning = "#f69240" / >

    < / s:fill >

    < s:stroke >

    < s:SolidColorStroke color = "#942EC8" alpha = "0.62" / >

    < / s:stroke >

    < / s:Ellipse >

    < / s:Graphic >

    < s:Graphic

    includeIn = "safe" width = "20" height = "20" version = "2.0".

    viewHeight = "600" viewWidth = "600" >

    < s:Path data = "M49, 294 L245, 410 L 551, 116 C 551, 116 259 519 257, 516 L 49 of the 294Z" winding = "not null" x = "-13,5" y = "-57.3" = "1.051689863204956" scaleY scaleX = "1.122194528579712" >

    < s:fill >

    < s:LinearGradient = "49" x = "115.95" scaleX = "402.4029386075604" rotation = "18.660078428615776" >

    < s:GradientEntry color = ' #359F66 ' ratio = "0.006535947712418301" / >

    < s:GradientEntry color = ' #7EFA4A ' ratio = "0.9803921568627451" / >

    < / s:LinearGradient >

    < / s:fill >

    < s:stroke >

    < s:SolidColorStroke color = "#C6A470" alpha = weight '1' = '1' / >

    < / s:stroke >

    < / s:Path >

    < / s:Graphic >

    < / s:HGroup >

    < / s:GridItemRenderer >

    Override getCurrentRendererState() to return the correct status based on the data.

Maybe you are looking for