ORA-00904: 无效标识符

发布于 2024-11-07 20:53:19 字数 1162 浏览 1 评论 0原文

我尝试使用 Oracle 数据库编写以下内部联接查询:

 SELECT Employee.EMPLID as EmpID, 
        Employee.FIRST_NAME AS Name,
        Team.DEPARTMENT_CODE AS TeamID, 
        Team.Department_Name AS teamname
 FROM PS_TBL_EMPLOYEE_DETAILS Employee
 INNER JOIN PS_TBL_DEPARTMENT_DETAILS Team 
 ON Team.DEPARTMENT_CODE = Employee.DEPTID

这给出了以下错误:

 INNER JOIN PS_TBL_DEPARTMENT_DETAILS Team ON Team.DEPARTMENT_CODE = Employee.DEPTID
                                              *
ERROR at line 4:
ORA-00904: "TEAM"."DEPARTMENT_CODE": invalid identifier

一个表的 DDL 是:

CREATE TABLE "HRMS"."PS_TBL_DEPARTMENT_DETAILS"
(
  "Company Code" VARCHAR2(255),
  "Company Name" VARCHAR2(255),
  "Sector_Code" VARCHAR2(255),
  "Sector_Name" VARCHAR2(255),
  "Business_Unit_Code" VARCHAR2(255),
  "Business_Unit_Name" VARCHAR2(255),
  "Department_Code" VARCHAR2(255),
  "Department_Name" VARCHAR2(255),
  "HR_ORG_ID" VARCHAR2(255),
  "HR_ORG_Name" VARCHAR2(255),
  "Cost_Center_Number" VARCHAR2(255),
  " " VARCHAR2(255)
)
SEGMENT CREATION IMMEDIATE PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS

I tried to write the following inner join query using an Oracle database:

 SELECT Employee.EMPLID as EmpID, 
        Employee.FIRST_NAME AS Name,
        Team.DEPARTMENT_CODE AS TeamID, 
        Team.Department_Name AS teamname
 FROM PS_TBL_EMPLOYEE_DETAILS Employee
 INNER JOIN PS_TBL_DEPARTMENT_DETAILS Team 
 ON Team.DEPARTMENT_CODE = Employee.DEPTID

That gives the below error:

 INNER JOIN PS_TBL_DEPARTMENT_DETAILS Team ON Team.DEPARTMENT_CODE = Employee.DEPTID
                                              *
ERROR at line 4:
ORA-00904: "TEAM"."DEPARTMENT_CODE": invalid identifier

The DDL of one table is:

CREATE TABLE "HRMS"."PS_TBL_DEPARTMENT_DETAILS"
(
  "Company Code" VARCHAR2(255),
  "Company Name" VARCHAR2(255),
  "Sector_Code" VARCHAR2(255),
  "Sector_Name" VARCHAR2(255),
  "Business_Unit_Code" VARCHAR2(255),
  "Business_Unit_Name" VARCHAR2(255),
  "Department_Code" VARCHAR2(255),
  "Department_Name" VARCHAR2(255),
  "HR_ORG_ID" VARCHAR2(255),
  "HR_ORG_Name" VARCHAR2(255),
  "Cost_Center_Number" VARCHAR2(255),
  " " VARCHAR2(255)
)
SEGMENT CREATION IMMEDIATE PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(15

赠佳期 2024-11-14 20:53:19

你的问题是那些有害的双引号。

SQL> CREATE TABLE "APC"."PS_TBL_DEPARTMENT_DETAILS"
  2  (
  3    "Company Code" VARCHAR2(255),
  4    "Company Name" VARCHAR2(255),
  5    "Sector_Code" VARCHAR2(255),
  6    "Sector_Name" VARCHAR2(255),
  7    "Business_Unit_Code" VARCHAR2(255),
  8    "Business_Unit_Name" VARCHAR2(255),
  9    "Department_Code" VARCHAR2(255),
 10    "Department_Name" VARCHAR2(255),
 11    "HR_ORG_ID" VARCHAR2(255),
 12    "HR_ORG_Name" VARCHAR2(255),
 13    "Cost_Center_Number" VARCHAR2(255),
 14    " " VARCHAR2(255)
 15  )
 16  /

Table created.

SQL>

Oracle SQL 允许我们忽略数据库对象名称的大小写,前提是我们使用全部大写的名称创建它们,或者不使用双引号。如果我们在脚本中使用混合大小写或小写字母并将标识符括在双引号中,则每当我们引用对象或其属性时,我们都必须使用双引号和精确的大小写:

SQL> select count(*) from PS_TBL_DEPARTMENT_DETAILS
  2  where Department_Code = 'BAH'
  3  /
where Department_Code = 'BAH'
      *
ERROR at line 2:
ORA-00904: "DEPARTMENT_CODE": invalid identifier


SQL> select count(*) from PS_TBL_DEPARTMENT_DETAILS
  2  where "Department_Code" = 'BAH'
  3  /

  COUNT(*)
----------
         0

SQL>

tl;dr

don不要在 DDL 脚本中使用双引号

(我知道大多数第三方代码生成器都会这样做,但他们有足够的纪律将所有对象名称都放在大写中。)


反之亦然。如果我们在不使用双引号的情况下创建表……

create table PS_TBL_DEPARTMENT_DETAILS
( company_code VARCHAR2(255),
  company_name VARCHAR2(255),
  Cost_Center_Number VARCHAR2(255))
;

我们可以在任何我们喜欢的情况下引用它及其列:

select * from ps_tbl_department_details

……或

select * from PS_TBL_DEPARTMENT_DETAILS;

……或

select * from PS_Tbl_Department_Details
where COMAPNY_CODE = 'ORCL'
and cost_center_number = '0980'

Your problem is those pernicious double quotes.

SQL> CREATE TABLE "APC"."PS_TBL_DEPARTMENT_DETAILS"
  2  (
  3    "Company Code" VARCHAR2(255),
  4    "Company Name" VARCHAR2(255),
  5    "Sector_Code" VARCHAR2(255),
  6    "Sector_Name" VARCHAR2(255),
  7    "Business_Unit_Code" VARCHAR2(255),
  8    "Business_Unit_Name" VARCHAR2(255),
  9    "Department_Code" VARCHAR2(255),
 10    "Department_Name" VARCHAR2(255),
 11    "HR_ORG_ID" VARCHAR2(255),
 12    "HR_ORG_Name" VARCHAR2(255),
 13    "Cost_Center_Number" VARCHAR2(255),
 14    " " VARCHAR2(255)
 15  )
 16  /

Table created.

SQL>

Oracle SQL allows us to ignore the case of database object names provided we either create them with names all in upper case, or without using double quotes. If we use mixed case or lower case in the script and wrapped the identifiers in double quotes we are condemned to using double quotes and the precise case whenever we refer to the object or its attributes:

SQL> select count(*) from PS_TBL_DEPARTMENT_DETAILS
  2  where Department_Code = 'BAH'
  3  /
where Department_Code = 'BAH'
      *
ERROR at line 2:
ORA-00904: "DEPARTMENT_CODE": invalid identifier


SQL> select count(*) from PS_TBL_DEPARTMENT_DETAILS
  2  where "Department_Code" = 'BAH'
  3  /

  COUNT(*)
----------
         0

SQL>

tl;dr

don't use double quotes in DDL scripts

(I know most third party code generators do, but they are disciplined enough to put all their object names in UPPER CASE.)


The reverse is also true. If we create the table without using double-quotes …

create table PS_TBL_DEPARTMENT_DETAILS
( company_code VARCHAR2(255),
  company_name VARCHAR2(255),
  Cost_Center_Number VARCHAR2(255))
;

… we can reference it and its columns in whatever case takes our fancy:

select * from ps_tbl_department_details

… or

select * from PS_TBL_DEPARTMENT_DETAILS;

… or

select * from PS_Tbl_Department_Details
where COMAPNY_CODE = 'ORCL'
and cost_center_number = '0980'
情释 2024-11-14 20:53:19

就我而言,由于表中不存在列名,因此发生了此错误。

当我执行“describe tablename”时,我无法找到映射 hbm 文件中指定的列。

修改表后,效果很好。

In my case, this error occurred, due to lack of existence of column name in the table.

When i executed "describe tablename" , i was not able to find the column specified in the mapping hbm file.

After altering the table, it worked fine.

灯角 2024-11-14 20:53:19

仅供参考,在这种情况下,发现原因是创建表的 DDL 中混合大小写的列名。

但是,如果您混合使用“旧式”和 ANSI 连接,即使使用大写表名正确完成 DDL,您也可能会收到相同的错误消息。这发生在我身上,谷歌将我发送到这个 stackoverflow 页面,所以我想我应该分享,因为我在这里。

--NO PROBLEM: ANSI syntax
SELECT A.EMPLID, B.FIRST_NAME, C.LAST_NAME
FROM PS_PERSON A
INNER JOIN PS_NAME_PWD_VW B ON B.EMPLID = A.EMPLID
INNER JOIN PS_HCR_PERSON_NM_I C ON C.EMPLID = A.EMPLID
WHERE 
    LENGTH(A.EMPLID) = 9
    AND LENGTH(B.LAST_NAME) > 5
    AND LENGTH(C.LAST_NAME) > 5
ORDER BY 1, 2, 3
/

--NO PROBLEM: OLD STYLE/deprecated/traditional oracle proprietary join syntax
SELECT A.EMPLID, B.FIRST_NAME, C.LAST_NAME
FROM PS_PERSON A
, PS_NAME_PWD_VW B 
, PS_HCR_PERSON_NM_I C 
WHERE 
    B.EMPLID = A.EMPLID
    and C.EMPLID = A.EMPLID
    and LENGTH(A.EMPLID) = 9
    AND LENGTH(B.LAST_NAME) > 5
    AND LENGTH(C.LAST_NAME) > 5
ORDER BY 1, 2, 3
/

上面的两个 SQL 语句是等效的并且不会产生错误。

当您尝试混合使用它们时,您可能会很幸运,或者您可能会收到 Oracle 有 ORA-00904 错误的信息。

--LUCKY: mixed syntax (ANSI joins appear before OLD STYLE)
SELECT A.EMPLID, B.FIRST_NAME, C.LAST_NAME
FROM 
    PS_PERSON A
    inner join PS_HCR_PERSON_NM_I C on C.EMPLID = A.EMPLID
    , PS_NAME_PWD_VW B
WHERE 
    B.EMPLID = A.EMPLID
    and LENGTH(A.EMPLID) = 9
    AND LENGTH(B.FIRST_NAME) > 5
    AND LENGTH(C.LAST_NAME) > 5
/

--PROBLEM: mixed syntax (OLD STYLE joins appear before ANSI)
--http://sqlfascination.com/2013/08/17/oracle-ansi-vs-old-style-joins/
SELECT A.EMPLID, B.FIRST_NAME, C.LAST_NAME
FROM 
    PS_PERSON A
    , PS_NAME_PWD_VW B
    inner join PS_HCR_PERSON_NM_I C on C.EMPLID = A.EMPLID
WHERE 
    B.EMPLID = A.EMPLID
    and LENGTH(A.EMPLID) = 9
    AND LENGTH(B.FIRST_NAME) > 5
    AND LENGTH(C.LAST_NAME) > 5
/

而无用的错误消息根本没有真正描述问题:

>[Error] Script lines: 1-12 -------------------------
ORA-00904: "A"."EMPLID": invalid identifier  Script line 6, statement line 6,
column 51 

我可以在以下博客文章中找到对此的一些研究:

中在我的例子中,我试图手动从旧样式连接转换为 ANSI 样式连接,并且一次一个表增量地执行此操作。这似乎是一个坏主意。相反,最好一次转换所有表,或者注释掉原始查询中的表及其 where 条件,以便与您正在编写的新 ANSI 查询进行比较。

FYI, in this case the cause was found to be mixed case column name in the DDL for table creation.

However, if you are mixing "old style" and ANSI joins you could get the same error message even when the DDL was done properly with uppercase table name. This happened to me, and google sent me to this stackoverflow page so I thought I'd share since I was here.

--NO PROBLEM: ANSI syntax
SELECT A.EMPLID, B.FIRST_NAME, C.LAST_NAME
FROM PS_PERSON A
INNER JOIN PS_NAME_PWD_VW B ON B.EMPLID = A.EMPLID
INNER JOIN PS_HCR_PERSON_NM_I C ON C.EMPLID = A.EMPLID
WHERE 
    LENGTH(A.EMPLID) = 9
    AND LENGTH(B.LAST_NAME) > 5
    AND LENGTH(C.LAST_NAME) > 5
ORDER BY 1, 2, 3
/

--NO PROBLEM: OLD STYLE/deprecated/traditional oracle proprietary join syntax
SELECT A.EMPLID, B.FIRST_NAME, C.LAST_NAME
FROM PS_PERSON A
, PS_NAME_PWD_VW B 
, PS_HCR_PERSON_NM_I C 
WHERE 
    B.EMPLID = A.EMPLID
    and C.EMPLID = A.EMPLID
    and LENGTH(A.EMPLID) = 9
    AND LENGTH(B.LAST_NAME) > 5
    AND LENGTH(C.LAST_NAME) > 5
ORDER BY 1, 2, 3
/

The two SQL statements above are equivalent and produce no error.

When you try to mix them you can get lucky, or you can get an Oracle has a ORA-00904 error.

--LUCKY: mixed syntax (ANSI joins appear before OLD STYLE)
SELECT A.EMPLID, B.FIRST_NAME, C.LAST_NAME
FROM 
    PS_PERSON A
    inner join PS_HCR_PERSON_NM_I C on C.EMPLID = A.EMPLID
    , PS_NAME_PWD_VW B
WHERE 
    B.EMPLID = A.EMPLID
    and LENGTH(A.EMPLID) = 9
    AND LENGTH(B.FIRST_NAME) > 5
    AND LENGTH(C.LAST_NAME) > 5
/

--PROBLEM: mixed syntax (OLD STYLE joins appear before ANSI)
--http://sqlfascination.com/2013/08/17/oracle-ansi-vs-old-style-joins/
SELECT A.EMPLID, B.FIRST_NAME, C.LAST_NAME
FROM 
    PS_PERSON A
    , PS_NAME_PWD_VW B
    inner join PS_HCR_PERSON_NM_I C on C.EMPLID = A.EMPLID
WHERE 
    B.EMPLID = A.EMPLID
    and LENGTH(A.EMPLID) = 9
    AND LENGTH(B.FIRST_NAME) > 5
    AND LENGTH(C.LAST_NAME) > 5
/

And the unhelpful error message that doesn't really describe the problem at all:

>[Error] Script lines: 1-12 -------------------------
ORA-00904: "A"."EMPLID": invalid identifier  Script line 6, statement line 6,
column 51 

I was able to find some research on this in the following blog post:

In my case, I was attempting to manually convert from old style to ANSI style joins, and was doing so incrementally, one table at a time. This appears to have been a bad idea. Instead, it's probably better to convert all tables at once, or comment out a table and its where conditions in the original query in order to compare with the new ANSI query you are writing.

七秒鱼° 2024-11-14 20:53:19

DEPARTMENT_CODE 不是 Team 表中存在的列。检查表的 DDL 以找到正确的列名。

DEPARTMENT_CODE is not a column that exists in the table Team. Check the DDL of the table to find the proper column name.

夏日浅笑〃 2024-11-14 20:53:19

就我而言,当我尝试在 Oracle 中创建一个新表时出现此错误,如下所示,在最后一行使用 ,

create table products(
  id_pro number primary key,
  product_name varchar2(20),
);

通过删除 , 问题解决如下

create table products_test(
  id_pro number primary key,
  product_name varchar2(20)
);

In my case I got this error when I tried to create a new table in Oracle like this with , in last line

create table products(
  id_pro number primary key,
  product_name varchar2(20),
);

By removing , the problem solved like this

create table products_test(
  id_pro number primary key,
  product_name varchar2(20)
);
缺⑴份安定 2024-11-14 20:53:19

您确定您的表格上有一列 DEPARTMENT_CODE PS_TBL_DEPARTMENT_DETAILS

更多信息

ORA-00904: 字符串: 无效标识符
原因:输入的列名缺失或无效。
操作:输入有效的列名称。有效的列名必须以
信,
小于或等于 30 个字符,并且仅包含
字母数字字符和
特殊字符 $、_ 和 #。
如果包含其他字符,则必须用 d double 括起来
引号。
它可能不是保留字。

Are you sure you have a column DEPARTEMENT_CODE on your table PS_TBL_DEPARTMENT_DETAILS

More informations about your ERROR

ORA-00904: string: invalid identifier
Cause: The column name entered is either missing or invalid.
Action: Enter a valid column name. A valid column name must begin with a
letter,
be less than or equal to 30 characters, and consist of only
alphanumeric characters and
the special characters $, _, and #.
If it contains other characters, then it must be enclosed in d double
quotation marks.
It may not be a reserved word.

绝影如岚 2024-11-14 20:53:19

我在尝试通过 JPA 保存实体时遇到此错误。

这是因为我有一个带有 @JoinColumn 注释的列,但没有 @ManyToOne 注释。

添加 @ManyToOne 解决了该问题。

I had this error when trying to save an entity through JPA.

It was because I had a column with @JoinColumn annotation that didn't have @ManyToOne annotation.

Adding @ManyToOne fixed the issue.

爺獨霸怡葒院 2024-11-14 20:53:19

还要确保发出查询的用户已被授予必要的权限。

对于表查询,您需要授予 SELECT 权限。
对于其他对象类型(例如存储过程)的查询,您需要授予 EXECUTE 权限。

Also make sure the user issuing the query has been granted the necessary permissions.

For queries on tables you need to grant SELECT permission.
For queries on other object types (e.g. stored procedures) you need to grant EXECUTE permission.

你的他你的她 2024-11-14 20:53:19

我有同样的例外,我的情况的问题是由于该列不存在于子查询中 - 尽管我知道“丢失”列/标识符属于我所指的别名的表。

示例 - 此查询在 MC.SIT_TYPE 列生成 ORA-00904 - 无效标识符

SELECT MC.ID_CODE,
       MC.EMP_NAME
FROM (SELECT MC.ID_CODE, 
             MC.EMP_NAME
      FROM EMP_WORKER MC) MC
INNER JOIN TEM_SHEETS FR ON MC.SIT_TYPE = FR.ID_CODE -- This line has the ORA-00904 error.
LEFT JOIN WRK_TYPE RAS ON MC.ID_CODE = RAS.ID_CODE;

现在,修改子查询后 - 通过添加 MC.SIT_TYPE 列 - 后,ORA-00904 消失。

结果:

SELECT MC.ID_CODE,
       MC.EMP_NAME
FROM (SELECT MC.ID_CODE, 
             MC.EMP_NAME, ​
            ​ -- Here, the "missing invalid identifier, in this case (MC.SIT_TYPE)" is added: 
             MC.SIT_TYPE
      FROM EMP_WORKER MC) MC
INNER JOIN TEM_SHEETS FR ON MC.SIT_TYPE = FR.ID_CODE 
LEFT JOIN WRK_TYPE RAS ON MC.ID_CODE = RAS.ID_CODE;

这里有一些提示:

  • 仔细检查代码的制表/缩进 - (取决于您的设置),SQL Developer 会以不同的方式处理代码的缩进。
  • 您正在处理的代码可能不会列表/缩进 - 使得此类错误的调试更加困难且耗时。
  • 修改列/子查询的别名 - 一般代码 - 用于生成唯一的别名 - 我的意思是:不要对子查询和相关表使用相同的别名。

I had the same exception and the problem in my case was due the column was not present in the sub-query - despite I know the "missing" column/identifier belongs to the table with the alias I'm referring to.

Example - this query generates the ORA-00904 - invalid identifier at the column MC.SIT_TYPE:

SELECT MC.ID_CODE,
       MC.EMP_NAME
FROM (SELECT MC.ID_CODE, 
             MC.EMP_NAME
      FROM EMP_WORKER MC) MC
INNER JOIN TEM_SHEETS FR ON MC.SIT_TYPE = FR.ID_CODE -- This line has the ORA-00904 error.
LEFT JOIN WRK_TYPE RAS ON MC.ID_CODE = RAS.ID_CODE;

Now, after modify the sub-query - by adding the MC.SIT_TYPE column - , the ORA-00904 disapears.

Result:

SELECT MC.ID_CODE,
       MC.EMP_NAME
FROM (SELECT MC.ID_CODE, 
             MC.EMP_NAME, ​
            ​ -- Here, the "missing invalid identifier, in this case (MC.SIT_TYPE)" is added: 
             MC.SIT_TYPE
      FROM EMP_WORKER MC) MC
INNER JOIN TEM_SHEETS FR ON MC.SIT_TYPE = FR.ID_CODE 
LEFT JOIN WRK_TYPE RAS ON MC.ID_CODE = RAS.ID_CODE;

Here are some tips:

  • Check very closely the tabulation/indent of your code - (depending of your settings), SQL Developer handles the indentation of your code different.
  • The code you're working on might not be tabulated/indented - making the debugging of these kind of errors harder and time-consuming.
  • Modify the aliases of your columns/sub-queries - code in general - for generate unique aliases - with this, I mean: don't use the same aliases for sub-queries and related tables.
神回复 2024-11-14 20:53:19

我在使用 eclipse link 的 JPA 2 中遇到了同样的异常。我有一个与实体具有一对一关系的 @embedded 类。
错误地,在嵌入类中,我还有注释 @Table("TRADER")。当 JPA 从实体创建数据库时,它还创建了一个 TRADER 表(这是一个错误,因为 Trader 实体嵌入到主实体中),并且每次我尝试时,该表的存在都会导致上述异常坚持我的实体。
删除 TRADER 表后,异常消失。

I had the same exception in JPA 2 using eclipse link. I had an @embedded class with one to one relationship with an entity.
By mistake ,in the embedded class, i had also the annotation @Table("TRADER"). When the DB was created by the JPA from the entities it also created a table TRADER (which was a wrong as the Trader entity was embedded to the main entity) and the existence of that table was causing the above exception every time i was trying to persist my entity.
After deleting the TRADER table the exception disappered.

戏舞 2024-11-14 20:53:19

我传递的值不带引号。一旦我通过了单引号内的条件,它就像一个魅力。

Select * from emp_table where emp_id=123;

使用以下内容代替上面的内容:

Select * from emp_table where emp_id='123';

I was passing the values without the quotes. Once I passed the conditions inside the single quotes worked like a charm.

Select * from emp_table where emp_id=123;

instead of the above use this:

Select * from emp_table where emp_id='123';
久隐师 2024-11-14 20:53:19

我收到错误消息是因为我错过了一个表别名并且没有使用。

由于“cl”别名,这会引发错误:

SELECT * FROM MYSCHEMA.COMPANYLOCATION_CL cl JOIN MYSCHEMA.COMPANYTYPE_CT ON MYSCHEMA.COMPANYLOCATION_CL.CLNR = MYSCHEMA.COMPANYTYPE_CT.CT_CL_NR 

没有“cl”,它可以正常工作:

SELECT * FROM MYSCHEMA.COMPANYLOCATION_CL JOIN MYSCHEMA.COMPANYTYPE_CT ON MYSCHEMA.COMPANYLOCATION_CL.CLNR = MYSCHEMA.COMPANYTYPE_CT.CT_CL_NR 

请不要抱怨表名 - 该模式已有 20 年历史了...

I got the error message because there was an table alias i missed and didn't use.

This throws the error because of the 'cl' alias:

SELECT * FROM MYSCHEMA.COMPANYLOCATION_CL cl JOIN MYSCHEMA.COMPANYTYPE_CT ON MYSCHEMA.COMPANYLOCATION_CL.CLNR = MYSCHEMA.COMPANYTYPE_CT.CT_CL_NR 

Without 'cl' it works fine:

SELECT * FROM MYSCHEMA.COMPANYLOCATION_CL JOIN MYSCHEMA.COMPANYTYPE_CT ON MYSCHEMA.COMPANYLOCATION_CL.CLNR = MYSCHEMA.COMPANYTYPE_CT.CT_CL_NR 

Please don't complain about the table names - the schema is 20 years old...

时光是把杀猪刀 2024-11-14 20:53:19

就我而言,错误是由于使用列名错误的大小写而引起的,看来您也遇到了同样的问题。

Department_Code 与 Oracle 的 DEPARTMENT_CODE 不同。

In my case the error was caused by using the wrong case for a column name and it seems you're having the same issue.

Department_Code isn't the same as DEPARTMENT_CODE for Oracle.

梦里梦着梦中梦 2024-11-14 20:53:19

今天我从数据库中得到了同样的错误。我的错误是我为休眠配置了错误的默认模式。

Today I got the same error from my database. My fault was that I had configured a wrong default schema for hibernate.

无远思近则忧 2024-11-14 20:53:19

查询行导致错误

Query line caused the error ????❌

SELECT * FROM USER ORDER BY UserName

Solved by putting two single quotation ????✅

SELECT * FROM USER ORDER BY 'UserName'
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文