oracle - oracle Form Alert syntax
问题描述
I want show alert when the Investor has not any transaction
Tables:
Investor
Investor_Number PK Number (7,0) Not Null
First_Name Varchar2 (25) Not Null
Last_Name Varchar2 (30) Not Null
Account_Number Number (7,0) FK Not Null
Portfolio
Portfolio_Number PK Number (7,0) Not Null
Investor_Number Number (7,0) FK Not Null
Portfolio_Description Varchar2 (50) Null
Transaction
Portfolio_Number PK Number (7,0) FK
Stock_Code Varchar2 (10) FK
Transaction_Date Date
Exchange_Code Varchar2 (4) FK
Broker_Number Number (7,0) FK
Buy_Sell Char (1)
DECLARE
V_count number;
BEGIN
select count(portfolio_number)
into V_count
FROM Transaction
where portfolio_number = :PORTFOLIO.portfolio_number;
If V_count = null then
Message('No Transaction');
End if;
END;
The code above not work, i don't know the syntax.
now I am using post-query at block level, when the Investor have not any Transaction will show an alert. Two block display "Investor" and "Portfolio". How it work is when click the next record, the record if has not any transaction, it will pop up an alert.
解决方案
假设您编写的查询正常工作,则需要进行两项更改:
COUNT
不会回来NULL
;即使它会,你会使用if v_count is null
,而不是if v_count = null
- 连续两次
MESSAGE
调用将强制 Forms 在屏幕上的弹出窗口中显示消息;如果您只使用一个MESSAGE
,它将显示在屏幕底部的状态行中- 或者,看看真正的警报是如何工作的;但是是的 - 2
MESSAGE
s 更简单
- 或者,看看真正的警报是如何工作的;但是是的 - 2
DECLARE
V_count number;
BEGIN
select count(portfolio_number)
into V_count
FROM Transaction
where portfolio_number = :PORTFOLIO.portfolio_number;
If V_count = 0 then --> COUNT never returns NULL
Message('No Transaction'); --> 2 consecutive MESSAGE calls to "simulate" an alert
Message('No Transaction');
else
Message('Number of transactions = ' || to_char(v_count));
Message('Number of transactions = ' || to_char(v_count));
End if;
END;
推荐阅读
- c# - 使用类库项目从 JSON 文件中读取数据
- asp.net-core - 从 Swagger Doc 中删除 AspnetVersioning ApiVersion
- javascript - Ramda:从谓词数组中拒绝
- python - 如何在不使用 XPath 的情况下使用 selenium 获取元素 Datetime?
- node.js - Nodejs不接收jsondata
- python-imaging-library - 如何在 Pillow 中设置后备字体?
- c++ - 在 malloc() 之后声明向量时出错
- angular - 反应式表单异步验证器未清除 FormGroup 中的错误
- java - 如何在 Java (Android Studio) 中从 DialogFlow 获取参数
- angular - 除了用户交互之外,究竟是什么将 Angular2 反应式 FormControl 标记为脏?