oracle - oracle 报告词法参数
问题描述
我正在使用 oracle 报告,但“SELECT ALL”有问题这是我的查询
SELECT * FROM company A, seller B
WHERE a.id = b.id
&(P)Company_id
在我使用的 oracle 报告中的 after 参数中
begin
if (:(V)Company_id is not null and :(V)Company_id<> '0')
:(P)Company_id:= ' and a.id ='||:(V)Company_id;
end if;
return (true)`
end;
如果 id 是所有数字000123
,则工作正常,但如果 id 像([L]00123)
结果是显示所有数据。我的词法参数需要帮助。
解决方案
您发布的信息具有误导性。我已经使用 Oracle Reports多年了,但我从未见过您使用的语法。您编写的代码甚至无法编译;那么它是如何工作的(这就是你所声称的)?根本没有(V)something
语法。
无论如何,从我的角度来看,你不需要一个词法参数而是一个简单的OR
条件,例如
select *
from company a join seller b on b.id = a.id
where (a.id = :par_company_id or :par_company_id is null)
- 它的第一部分,
a.id = :par_company_id
将返回 ID 等于您在参数表单中输入的值的行 - 第二部分,
or :par_company_id is null
如果您将参数值留空,将返回所有行
推荐阅读
- java - Gitlab 批准合并请求
- spring-boot - 可以在spring boot中自定义属性文件吗?
- django - 从 http 服务器触发 WebSocket 服务器
- c++ - const 初始化程序列表因 gcc 而失败
- docker - \! 是什么意思?意思是?寻找 。\!-user redis -exec chown redis '{}' +
- android - 我需要一个意图来选择具有特定格式的视频
- python - Pandas 读取列长不均匀的文件
- google-classroom - 将教师添加到教室时出错 - 前提条件失败
- c# - 为什么 foreach 循环因 XML 中的一个子元素而失败?
- docker - 如何使用 iptables 阻止从互联网访问 docker 容器端口?