0

I am new to Oracle APEX, i am using Oracle APEX version 20.2, i have page item called P720_DDL_MONTH_FROM.

We are getting the value for that page item for date picker Month From is like below query.

enter image description here

enter image description here

enter image description here

From the list of values page attribute:

 SELECT MON.NAME D, MON.MONTH R
 FROM (SELECT DISTINCT(NAME) "NAME", TO_NUMBER(MONTH) "MONTH" 
 FROM 
 MONTH_YEAR) MON
 ORDER BY MON.MONTH

From the Default values for pageItem:

DECLARE L_VALUE NUMBER;
BEGIN
SELECT DISTINCT(MONTH) INTO  L_VALUE FROM MONTH_YEAR
WHERE UPPER(NAME) IN (SELECT TO_CHAR(ADD_MONTHS(TO_DATE(SYSDATE), -1), 'MON') FROM DUAL);
RETURN L_VALUE;
END;

I am facing an NO DATA FOUND issues while getting the default value for the above sql and plsql block, can anyone please clarify what is the issues from the above query, and let me due to some functionalities may be deprecated in apex latest version

Thanks,

Littlefoot
  • 131,892
  • 15
  • 35
  • 57
  • You may check old [9i reference](https://docs.oracle.com/cd/B10501_01/appdev.920/a96624/07_errs.htm#784), which describes the meaning of this exception and how you can avoid it. Unfortunately they left behind a bunch of very nice and detailed description of error codes in 9i docs – astentx Jul 02 '21 at 07:50

1 Answers1

0

If you got no_data_found, it means that there are no rows that satisfy condition(s) you wrote.

For sample table

SQL> SELECT * FROM month_year;

     MONTH NAME
---------- --------------------
         4 APR
         6 JUN

query returns something (a value for June) (note that you don't need a subquery; directly use TO_CHAR(...)):

SQL> SELECT DISTINCT month
  2    FROM month_year
  3   WHERE UPPER (name) = TO_CHAR (ADD_MONTHS (TO_DATE (SYSDATE), -1), 'MON');

     MONTH
----------
         6

SQL>

If you got nothing, you should check contents of the month_year table and see what's going on.

Littlefoot
  • 131,892
  • 15
  • 35
  • 57