我正在使用Laravel 5.4连接到Oracle DB。
创建的表名为ACCOUNT(大写)。
我创建了名为Account的模型类,并设置:
protected $table = 'account';
当我使用此模型或表帐户执行任何查询时,表名被双引号并抛出QueryException:
QueryException in Connection.php line 647:
Error Code : 942
Error Message : ORA-00942: table or view does not exist
Position : 29
Statement : select * from (select * from "account" where "account"."ID" = :p0) where rownum = 1
Bindings : [123]
(SQL: select * from (select * from "account" where "account"."ID" = 123) where rownum = 1)
显然,Oracle将无法找到表“帐户”,因为只存在“帐户”。如果表名不是双引号(那么它不区分大小写)。
因此,当我将表名更改为account2时,表名会变为大写?
QueryException in Connection.php line 647:
Error Code : 942
Error Message : ORA-00942: table or view does not exist
Position : 29
Statement : select * from (select * from "ACCOUNT2" where "ACCOUNT2"."ID" = :p0) where rownum = 1
Bindings : [461060]
(SQL: select * from (select * from "ACCOUNT2" where "ACCOUNT2"."ID" = 461060) where rownum = 1)
问题是......