Posted by : Akshay Patil Tuesday, 14 April 2015

    Select list item in oracle apex always have two values that is display value and return value.
Syntax :
SELECT Display_Value,Return_Value FROM Table_Name;
E.g.:
 SELECT EXPENSE_START_DATE,PERIOD_ID FROM U_EXPENSE_PERIODS;

    To set the default value for a Select List item, set Default Value Type to PL/SQL Function Body, then enter your SQL query (that returns a single value) in the Default attribute for the item, with suitable PL/SQL around it.
Single value column specifyied in sql query must be same as return value column specified in source query of select list.
Syntax:
DECLARE
  v_value VARCHAR2(<your data max length>);
BEGIN
  SELECT <yourcolumn>
  INTO v_value
  FROM <yourquery>;
  RETURN v_value;
END;

E.g.:
DECLARE
  v_value number;
BEGIN
  SELECT PERIOD_ID
  INTO v_value
  FROM U_EXPENSE_PERIODS
  WHERE TO_CHAR(EXPENSE_START_DATE, 'Mon-YY') = TO_CHAR(SYSDATE, 'Mon-YY') ;
  RETURN v_value;
END;

Leave a Reply

Subscribe to Posts | Subscribe to Comments

Welcome to My Blog

Study Basics

Oracle APEX Oracle SQL Oracle PL/SQL

Popular Post

Blogger templates

Total Pageviews

Powered by Blogger.

Unordered List

Follow us on Facebook!

- Copyright © TechnicalBits -Robotic Notes- Powered by Blogger - Designed by Johanes Djogan -