首页 > 解决方案 > 数据模型出错无法执行,请联系管理员

问题描述

我有一个数据集,其中包含参数按名称、日期和编号排列的列。但是每次我查看数据时都会出现一个错误The data model cannot be executed because of an error, please contact the administrator.但它只显示消息但没有显示错误的详细信息。我还有一个值列表,因为我将参数的参数类型设置为namenumber作为menu将返回的结果number是基于的,name因为如果我不基于名称,它将返回 100+对我的用户来说不合适的值。

例如,我对数据集的查询是,

select a.name, a.date, a.type_name, b.number, c.address
from details1 a, details2 b, details3 c
where
a.id = b.id
and b.id = c.id
and a.name = :name
and a.date between :start_date and :end_date
and b.number = :number

值列表查询name

select a.name from details1 a
where a.type_name = 'person'

值列表查询num

select b.number
from details1 a, details2 b
where 1=1
and a.id = b.id
and a.name = :name

标签: oracleplsqloracle-sqldeveloperbi-publisher

解决方案


我不知道 BI Publisher,但是 - 就 Oracle 而言,列名不能number. 它是数据类型的保留字:

SQL> create table test (number number);
create table test (number number)
                   *
ERROR at line 1:
ORA-00904: : invalid identifier

您的查询使用这样的列:

select b.number ...

这是行不通的,除非有人通过将列名括在双引号中来创建这样的表,例如

SQL> create table test ("number" number);

Table created.

SQL> desc test
 Name                                      Null?    Type
 ----------------------------------------- -------- ---------------
 number                                             NUMBER

SQL>

但是,您每次都必须使用双引号指定这样的列名,注意字母大小写(意思是:如果列创建为“NumBER”,则必须以这种方式引用它。“numBER”或“NUMber " 或 "nUmBeR" 或 "number" 或 "NUMBER" 不起作用)。几个例子:

SQL> insert into test (number) values (1);
insert into test (number) values (1)
                  *
ERROR at line 1:
ORA-00928: missing SELECT keyword


SQL> insert into test ("NUMber") values (1);
insert into test ("NUMber") values (1)
                  *
ERROR at line 1:
ORA-00904: "NUMber": invalid identifier


SQL> insert into test ("NUMBER") values (1);
insert into test ("NUMBER") values (1)
                  *
ERROR at line 1:
ORA-00904: "NUMBER": invalid identifier


SQL> insert into test ("number") values (1);

1 row created.

SQL> select t."number" from test t;

    number
----------
         1

SQL>

因此,我建议您检查表格描述并尝试您所看到的;也许它很简单

select b."number" ...

如果是这样的话,很明显,因为你做某事而做某事并不意味着你应该去做。避免这样的事情,永远不要将 Oracle 对象名称括在双引号中,使用默认值。


推荐阅读