exception: when no data found

Hello
I want to assign a variable var1 leave a select query
Select attr1 in var1 from table1 where (condition)
So I want to 0 when no data found in this application, without throwing an exception, the attr1 value so without stopping the program
someone has an idea?

Thank you
concerning
ELYES

Hope this helps:

DECLARE
v_count PLS_INTEGER;
BEGIN
SELECT COUNT(1) INTO v_count FROM TABLE1 WHERE (CONDITION);

IF v_count = 0 THEN
DBMS_OUTPUT.PUT_LINE('NO DATA FOUND');
ELSE
DBMS_OUTPUT.PUT_LINE('DATA AVAILABLE');
END IF;

EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE('OTHER EXCEPTION');
END;

Tags: Database

Similar Questions

  • Redirect when no data found

    Using Apex 4.1.1

    I need my application to redirect to another page when the user performs a search and there is no data found. The query in the report is too complicated and is a "Body of function from PL/SQL returning SQL query" and must be like that. It just does not work on its own.

    Initially, I tried to Javascript to run onLoad & run loading Page like:
    function redirect_on_no_data_found2()
    {
         
         // if user came from non-catalogue page
         if($(".nodatafound").html() == "no data found")
         {     
              redirect('f?p=129:8:'+$v('P1_SESSION_ID_VALUE')+':NO_DATA_FOUND:NO::');
         }
         
    }
    But javascript as it's too unreliable in IE 7, which is what users use and does not work in some cases while in others works.


    Is there another way I could do a redirect without javascript or using the APEX_APPLICATION.redirect procedure. Little short of ideas.

    Thank you very much.

    Hello

    I wrote this blog post where is also link to example
    http://dbswh.webhop.NET/HTMLDB/f?p=blog:read:0:article:6611800346018314

    I have test, you must use a fixed value as function APEX_UTIL. SAVEKEY_VC2 call parameter and select the double wrap.
    In this way, the function is called only once in the report query.

    Kind regards
    Jari
    -----
    My Blog: http://dbswh.webhop.net/htmldb/f?p=BLOG:HOME:0
    Twitter: http://www.twitter.com/jariolai

  • How to hide the buttons when no data found!

    Hi all

    I created two regions

    1 Serach region
    2 results region.

    Initially during the loading of the page with the help of hidden drive I'm Basel to hide 'areas of results' once that they clik this serach button I display area with teo translated region more buttons as buttons 'export' and 'print '.

    It shows very well when there is data in the region of Reulst.
    But when there is no return I displays the message "No data found" but at the same time it displays 'export' and buutons 'print '.
    This button should show only when data are available in the results area.

    Thank you
    David...

    abhishek8299 wrote:
    Use SQL statements (Exists) in the State and write an sql statement it.

    Use this

    SELECT
    1
    FROM form1 MF,bench1 BM,
    participant1 PP,key1 KT
    WHERE MF.ENGAGEMENT_ID=BM.ENGAGEMENT_ID
    AND BM.ENGAGEMENT_ID =PP.ENGAGEMENT_ID
    AND PP.ENGAGEMENT_ID =KT.ENGAGEMENT_ID
    
  • APEX 4.2 classic report when more data found message

    Hello

    Has anyone used report classic message "Times more data found" APEX 4.2?

    I did not get this message illustrated using any report model or any report parameter.

    Need to add a few report template substitution strings?

    It would be great if someone could share example how this message should be used.

    Kind regards
    Jari

    Hi kvlek,

    Thank you

    Could you please share steps how you did it in apex.oracle.com?

    Kind regards
    Jari

  • No data found exception

    Hello

    I wrote code like this... But I'm not get when no data found exceptional... Please advise... !!!
    create or replace procedure dis_emp(v_empno in number) as 
    
       cursor kk is select * from empl where empno=v_empno;
    
       a kk%rowtype;
    
    
    begin
            open kk;
          
         loop
    
             fetch kk into a;
             exit when kk%notfound;
         dbms_output.put_line(a.empno||'  '||a.ename||'  '||a.job);
         
    end loop;
    close kk;
            
    
    exception
    when no_data_found then
       dbms_output.put_line('Sorry...wrong empid');
    
    
     when others then
       dbms_output.put_line('sorry..');
          
    end;
    concerning
    SA

    Hello

    The no_data_found exception is thrown when you use select it without cursor... under construction.

    And that's exactly what you use when you perform simple extractions. There's nothing "smart" on the declaration of a cursor, instead.

    create or replace procedure dis_emp(v_empno in number) as
         a empl%rowtype;
    begin
         select * into a
         from empl
         where empno=v_empno;
    
         dbms_output.put_line(a.empno||'  '||a.ename||'  '||a.job);
    exception
    when no_data_found then
        dbms_output.put_line('Sorry...wrong empid');
    end procedure dis_emp;
    /
    

    Also note, don't get any exception when you are not really going to deal with.

    Concerning
    Peter

  • report "no data found".

    Hello together,

    I use Apex 4.2.4 with a DB XE on Windows.

    I'm creating a mobile application.

    I created a report showing specific information from the user.

    Sometimes, it is possible that there is no information available. In this case the report displays the message/exception "no data found".

    Is there a solution to hide this message?

    My plan is to show only the data if they are available and show nothing when no data found.

    For the user, it should look like this, there is not a report if no data is available.

    I don't want to see the message "no data found".

    Thanks for your help

    Joe

    Joe_990933 wrote:

    I use Apex 4.2.4 with a DB XE on Windows.

    My plan is to show only the data if they are available and show nothing when no data found.

    For the user, it should look like this, there is not a report if no data is available.

    Control if the area of report is displayed using a Exists (SQL query returns at least one row) condition with a query that returns at least one row if the report contains data.

  • Change/Remove "No data found" Message

    Hi all

    How can I change or delete no data found message?

    I can change it by using report attributes > messages > when no data found > (Personal Message), but how can I change/remove it globally (for all the application)?

    Thank you

    Chandra

    Chandra,

    There is a possible way to remove without data Message found at one time to go to

    Modify Application > utilities > specific utilities (appear in the right sidebar) page > region utility > utility region report > grid edit all data found Message numbers

    Here you can write your personal message for each report at a time.

    Leave.

  • When I try to change the interactive report columns, then triggers the error: "unable to change column attributes. "ORA-01403: no data found. Pls tell me why?

    When I try to change the interactive report columns, then triggers the error: "unable to change column attributes. "ORA-01403: no data found. Pls tell me why?

    You use listener EA3 ADR?

  • Chart does not display not when No data Message found

    Apex workspace version: 4.2.0.00.27

    Internet Explorer 9

    Flash graphic

    Oracle Database 11 g Enterprise Edition Release 11.2.0.3.0 - 64 bit Production

    I have developed a standard 2-d column chart that works very well when there are data. I created the graph with the property "When no. found data Message" as "No data Found".


    But this message does not appear when there is no data. The entire table is completely empty. I do not use a custom xml part. It is a simple, standard 2-d column chart. I could see the message "Waiting for data" briefly for a second, then the table renders as white space. I just want the "No data found" message appears every time the data source group is empty.


    I tried to create a diagram of the test in a virtual space that is running on the 4.2.3.00.008 apex version. Whenever the source dataset contains zero return to recording, the message "No data found" seems in good condition.

    Any ideas or suggestions?

    I'm sorry. The question above was going on because my source dataset returned some NULL records even when there was no valid data. (inner left join instead of join). This is the reason why the chart didn't show a message "no data found". It's a coding problem, not a problem of the apex. I apologise for the confusion.

  • Process page not throwing no data found error when you remove the item in a table

    Hi guys,.

    I'm trying to run a process page just before the process of MRU in tabular form and it is throwing an error no data found . Here is my code:
    BEGIN
         
         for i in 1..apex_application.g_f02.count LOOP     
              
              IF apex_application.g_f01(i) is not null THEN
                   
                   UPDATE STOCK
                        SET PRODUCT_QUANTITY = PRODUCT_QUANTITY+apex_application.g_f08(i)
                   WHERE site_id = :P21_SITE_ID and product_id = apex_application.g_f02(i);
                   COMMIT;
                   
              END IF;
         END LOOP;
    END;
    F01 here is the checkbox column and the if statement is the cause of the problem because if I get rid of the update statement (leaving just the commit) then it still throws the error.

    When I click on a checkbox, and hit the Remove button what fires off times this process and then the MRU, I get the error not found data .

    Would appreciate it if someone could shed some light on this. Thank you very much.

    Published by: taepodong on July 1, 2012 07:54

    Hello

    >
    I'm trying to run a process page just before the process of MRU in tabular form and he throws no data were found error. Here is my code:

    BEGIN
    
         for i in 1..apex_application.g_f02.count LOOP     
    
              IF apex_application.g_f01(i) is not null THEN
    
                   UPDATE STOCK
                        SET PRODUCT_QUANTITY = PRODUCT_QUANTITY+apex_application.g_f08(i)
                   WHERE site_id = :P21_SITE_ID and product_id = apex_application.g_f02(i);
                   COMMIT;
    
              END IF;
         END LOOP;
    END;
    

    Here f01 is the column of the box and the if statement is causing the problem because if I get rid of the update statement (leaving just the commit) then it still throws the error.

    When I click on a checkbox and click on Remove button that triggers both this process and then MRU, I get the no found error of data.
    >

    You iterate over the f02 and seeking f01 not null. It's the misuse of the checkbox element. Please see these links. in particular the examples of process OnSubmit.
    http://docs.Oracle.com/CD/E23903_01/doc/doc.41/e21676/apex_item.htm#CHDDCHAF
    http://docs.Oracle.com/CD/E23903_01/doc/doc.41/e21676/apex_app.htm#AEAPI215

    Kind regards

    PS: That's what you need to understand
    >
    Note that the boxes displayed by using APEX_ITEM. CHECK box will only contain values in the APEX_APPLICATION tables for those lines that are checked. Unlike other elements (TEXT, TEXTAREA, and DATE_POPUP) that can contain an entry in the corresponding table of APEX_APPLICATION for all submitted ranks, a checkbox will be an entry in the APEX_APPLICATION table if this option is selected.
    >

    Published by: Dominique July 2, 2012 09:44

  • Interactive report: "no data found" when first loading

    Hello

    I use APEX 4.0 with Oracle 10 g r2 under Windows XP Pro SP3.

    I have an interactive report and a menu with a few items to filter the report.

    The problem is that the first time I load the page, the report shows "no data found", when I reboot, it works. If I navigate to another page and then I go back to the page of report, it also works.

    There seems to be a problem with session state, but I can't found how do works, even using an AJAX setItemInSessionState() function.

    The query depends on the values of the elements:
    select
         SPAT_ID, SPAT_ACCL_NAME, SPAT_AREA_NAME, SPAT_CLASS, SPAT_NUMBER, SPAT_PT, SPAT_TYPE, SPAT_STATUS,
         round(SPAT_CUMUL,2) as "SPAT_CUMUL"
    from
         SPATIAL_POINTS
    where
         upper(SPAT_AREA_NAME) LIKE upper(:P3_FILTRE_AREA_NAME)
    AND upper(SPAT_CLASS) LIKE '%'||upper(:P3_SPATIAL_CLASS)||'%'
    AND upper(SPAT_NUMBER) LIKE '%'||upper(:P3_FILTRE_NUMBER)||'%'
    AND instr(upper(:P3_SPATIAL_POINT_VALUES),upper(nvl(SPAT_PT,' '))) > 0
    AND instr(upper(:P3_SPATIAL_TYPE_VALUES),upper(SPAT_TYPE)) > 0
    AND (:P3_FILTRE_ACC_NAME IS NULL AND spat_accl_name IS NULL OR CASE WHEN :P3_FILTRE_ACC_NAME = '%' THEN nvl(spat_accl_name,'_NULL_') ELSE :P3_FILTRE_ACC_NAME END = nvl(spat_accl_name,'_NULL_'))
    I've implemented on apex.oracle.com, if you find the time to take a look: http://apex.oracle.com/pls/apex/f?p=4550:1
    You should get a "no data found" the first time the page loaded.

    Workspace : yb202826
    login : User1
    password : u_s_e_r_1
    application : 20588. Page 1 of the Geode

    Thank you!

    Yann.

    This problem is described here:

    http://Apex.Oracle.com/pls/OTN/f?p=31517:117

    Denes Kubicek
    -------------------------------------------------------------------
    http://deneskubicek.blogspot.com/
    http://www.Opal-consulting.de/training
    http://Apex.Oracle.com/pls/OTN/f?p=31517:1
    http://www.Amazon.de/Oracle-Apex-XE-Praxis/DP/3826655494
    -------------------------------------------------------------------

  • Hide the "No data found" msg in the region to report when you 1st click Search page

    Hello

    (Sorry if it's confusing but my APEX is in FRENCH and I tried to translate)

    I created a search page in my application.

    1. I have an HTML region, with a search box and I have the search button

    2 - I have a region (PL/SQL source) report, which sometimes does not return any data, giving a message 'No Data Found.'.


    When I click on the search page for the 1st time (on my navigation bar), I like to HIDE the region report so that I do not have the message "no data found".

    Only once we click the search button and there is no result, I want to have the message "no data found".

    How can I achieve this?

    Thank you

    Roseline

    1. create an item hidden on your page (P1_HIDDEN_ELEMENT)

    2. place your message no data found in a span tag

    No Data Found
    

    3 create a load calculation to set your P1_HIDDEN_ELEMENT to 'no_data_found' if it is NULL and put it to ' ' if it is NOT NULL - body of the type PL/SQL function

    BEGIN
       IF :p1_hidden_element IS NULL
       THEN
          RETURN '';
       ELSIF :p1_hidden_element IS NOT NULL
       THEN
          RETURN ' ';
       END IF;
    END;
    

    4 put this in the footer:

    &P1_HIDDEN_ELEMENT.
    

    The alternative would be to create a display area – pure HTML and display only the first. Once the search has begun this region would remain hidden and only the report themselves.

    Denes Kubicek
    -------------------------------------------------------------------
    http://deneskubicek.blogspot.com/
    http://www.Opal-consulting.de/training
    http://Apex.Oracle.com/pls/OTN/f?p=31517:1
    http://www.Amazon.de/Oracle-Apex-XE-Praxis/DP/3826655494
    -------------------------------------------------------------------

  • When the research report I get the message "no data found".

    When I run a search on one of the fields of research, I get the message "no data found". Anyone can help me to understand what it is that I don't hurt or not done? Thank you

    Deanna

    http://Apex.Oracle.com/pls/OTN/f?p=4550:1:4031563210204584

    Workspace: DEANNA2
    Username: DDOVE@KHP. KS.GOV
    Password: Dclipse03

    Page 21

    No, I added a calculation to the page to see what is the sql code that is returned by the function... Now, I could add in another column and see what happens...

    That's why I suggested moving it to a function outside the page... You can test this in the sql command window and the prefect what you are after... Have done reports a little like this... Or even more fun, with a function in the pipeline...

    Thank you

    Tony Miller
    Webster, TX

  • Get "no data found" when I download the report

    Hai...

    In my application, I created a region of reports where the data are displayed... I gave 'Download' format csv... when I try to download, I could not the data in the spreadsheet "excel" his coming as no data found...


    What could be the problem...

    Please help me...


    David

    Hi David,

    I've always found preferable to set the value of the element on a page using a calculation when I want him to have a starting value that does not rely on a database column.

    On your two fields, set the static allocation Type of Source and remove source.

    Now, on your page, click on the button create (icon +) in the section of the Page rendering calculations. Then enter the following settings:

    Geographical area: item on this page
    Point calculation: select your P1_STARTDATE
    Calculation Point: Before header
    Calculation type: SQL query
    Calculation: Select TO_CHAR(SYSDATE-1,'MM/DD/YYYY') from Dual
    Condition Type: Article 1 of the Expression value is NULL
    Expression 1: P1_STARTDATE

    Repeat this for your usng P1_ENDDATE Select TO_CHAR(SYSDATE,'MM/DD/YYYY') from Dual to the query

    Now, when the page is loaded first, the calculation conditions are checked. As the two fields are empty, the calculations are made and items get their start values. Your application should then work ok for export.

    Andy

  • Manage data source except when starting server in weblogic

    Hello

    I have weblogic 10.3.6, and I set datasource and deploy the application, the problem is when the datasource will not connect to the database, for example if the weblogic Server DB will be status "ADMIN" rather that "RUN", how do I manipulate datasource exception when start weblogic server

    Thank you

    OK, try this:

    'Set the InitialCapacity from the DataSource to 0 (zero) so that weblogic will not try to create any object of JDBC connection initially towards up so time like this that we can avoid the connection failed to create the conditions and prevent any movement of our State of the ADMIN server'

    WebLogic Server is in the ADMIN? "Middleware Magic."

    Kind regards

    White

Maybe you are looking for

  • Pavilion Slimline desktop computer: Reinstall W7 Home Premium on a new disc

    I need to replace the disk of har on that office that the original one failed.  I'll have to reinstall the operating system (Windows 7 Home Premium 64-bit).  Windows was originally preinstalled on the disc when buying so I don't have the original ins

  • Create the reference coordinate system

    ? Need help to dynamically create a reference guide.  Use the Vision Assistant these constant reference of basic places are created automatically. I can't find any real documentation of the code examples on how to do it dynamically.  See picture atta

  • How the NI9263 binary code is mapped with output voltage?

    In the specification of NI9263, he says he is 16 bits and has a range of +-10V output. Does this mean that the 16-bit extends the range of - 10V to + 10V? I don't need one bipolar output, so that means that I am limited to the resolution of 15 bits,

  • How to recover junk e-mail on Outlook Express 6

    I don't get emails sent to a group address list but I got emails individually sent to my address (same as the group list). It has been suggested that emails may go in the 'Junk e-mail' folder but my OE 6 program doesn't have a junk folder. I don't re

  • What does it mean when windows 7 can't copy the files required for installation?

    I tried to install windows 7 on my Dell.I have xp on it, but when I run the first step of copying the files it stops to 60% and says "windows cannot copy files required for installation. Make sure all files required for installation are available, an