Failed to create creation time in APEX report

大城市里の小女人 提交于 2019-12-25 04:13:42

问题


I am using Oracle APEX to build a interactive report. In the create page I want to inert a field called create_time in the database which is not shown on the create page. Similarly, in the edit page, I want to update a field called update_time in the database.

For the edit page, I added a process and set the plsql code to:

update table_test t set t.UPDATE_DATE = sysdate 
       where t.ROWID = :P2_ROWID;

And this works.

However, when it comes to the create page, I set the plsql code to:

update table_test t set t.CREATE_DATE = sysdate 
       where t.PROJECT_ID= :P3_PROJECT_ID; 

This didn't work. Then I hardcoded the where clause to sth like this: where t.PROJECT_ID='100', and I create a project with id = 100, and it works! So I suppose, for some reason this :P3_PROJECT_ID failed to fetch the value. Anyone knows why? And is there any other ways to insert create_time other than using process? Thanks!


回答1:


The reason is that APEX does not know the value of :P3_PROJECT_ID unless your process uses ID as the PK and returns the PK value.

A far easier way for both Create / Update columns is so create a DB Trigger on the table which fires whenever a record is inserted / updated , including from SQL Workshop or outside APEX all together. Install one of the Sample Apps and look at the triggers on the tables for best practices.



来源:https://stackoverflow.com/questions/39276122/failed-to-create-creation-time-in-apex-report

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!