0
votes

I am very new to Oracle Apex/PLSQL and have built basic application by editing the templates provided in Apex.

My question is that I have a form which saves data into one table. One date field on the form is "Due Date" where the user selects a future date. I have another text field (disabled) named DAYS REMAINING where I want to show DUE DATE - TODAY'S Date (number of days only, no time). I have added a new column in the backend table with same name (DAYS REMAINING) and number data type. In the DAYS REMAINING textbox's "value" section, I have tried calculating days difference by using SELECT DUE DATE (column) - CURRENT_DATE but the result is error.

Could someone advise a simple work around for getting the number of days on the form. The form ultimately saves the data to table.

1
What was the error? Does your SELECT statement have a FROM clause that you're omitting? Are you assigning the value to a page item? Are you doing a SELECT INTO?Justin Cave
This may help you with your processing, but your exact syntax is going to help grassroots-oracle.com/2013/10/apex-101-dynamic-actions.htmlScott
What i actually want is similar to this stackoverflow.com/questions/62327932/… the difference is that i want to perform a calculation on dates (DUE DATE minus Current Date) and get the result in number of days.Ahmed Chishti

1 Answers

1
votes

APEX EXAMPLE CREATED: enter image description here


enter image description here

UPDATED Answer based on comments:

Ensure you use Items to Submit and Items to Return fields.

Use a query similar to the following in your dynamic Action:

SELECT ROUND(TO_DATE(:P1_DUE_DATE)-SYSDATE) INTO :P1_DAYS_REMAINING FROM DUAL;

OLD Fiddles:

  1. sqlfiddle.com
  2. sqlfiddle.com