无法在APEX报表中创建创建时间 [英] Failed to create creation time in APEX report

查看:136
本文介绍了无法在APEX报表中创建创建时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Oracle APEX构建交互式报告.在创建页面中,我想在数据库中插入一个未创建的字段,该字段名为create_time.同样,在编辑页面中,我想更新数据库中名为update_time的字段.

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.

对于编辑页面,我添加了一个过程并将plsql代码设置为:

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;

这可行.

但是,当涉及到创建页面时,我将plsql代码设置为:

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; 

这不起作用.然后,我将where子句硬编码为这样:where t.PROJECT_ID ='100',然后创建一个id = 100的项目,它可以正常工作!所以我想,由于某种原因,:P3_PROJECT_ID无法获取该值.有人知道为什么吗?除了使用process以外,还有其他任何方法可以插入create_time吗?谢谢!

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!

推荐答案

原因是除非您的进程使用ID作为PK并返回PK值,否则APEX不知道:P3_PROJECT_ID的值.

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.

创建/更新列的一种简单得多的方法是在表上创建一个数据库触发器,每当插入/更新一条记录(包括从SQL Workshop或APEX以外的所有记录)时都会触发该触发器. 安装示例应用程序之一,并查看表上的触发器以获取最佳实践.

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.

这篇关于无法在APEX报表中创建创建时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆