【问题标题】:Error ORA-00936 in Laravel Eloquent relationshipLaravel Eloquent 关系中的错误 ORA-00936
【发布时间】:2020-05-02 21:38:44
【问题描述】:

首先,请原谅我的英语,

我正在使用 oracle 数据库 我有两个模型之间的一对一关系

Class A
{
public function ARelation{
    return $this->hasOne(B::class,’Table_A_ID’,’id’);
}}
Class B
{

public function BRelation{

    return $this->belongsTo(A::class,’Table_A_ID’,’id’);
}}

现在当我尝试

A::with(’Arelation’)->get();

我收到以下错误

PHP 警告 oci_execute():ORA-00936: 缺少表达式 路径/供应商/yajra/laravel-pdo-via-oci8/src/Pdo/oci8/statement.php on 第 159 行 Illuminate/Database/QueryException 与消息错误代码 :936 错误消息:ORA-00936:缺少表达式位置:74 语句:select * from "Table_B" where ("Table_B"."Table_A_ID" in (0,1,2,3,4 到 3999) or or or or or ”Table_B”.”Table_A_ID” in (4000,4001,4002, to 4999) or or or or this 不断重复直到达到 我数据中的最后一个 ID 是 10K 绑定:[] select * from “Table_B” where (”Table_B”.”Table_A_ID” in (0,1,2,3,4 to 3999) or or or or or ”Table_B”.”Table_A_ID” in (4000,4001,4002, to 4999) or or or this keep getting 重复直到它到达我数据中的最后一个 ID,即 10K

根据我的搜索和我看到的所有教程,这段代码应该可以运行,但由于未知原因它在我的情况下不起作用

【问题讨论】:

    标签: php laravel oracle eloquent


    【解决方案1】:

    首先你有一个拼写错误。应该是

    A::with(’Arelation’)->get();
    

    似乎每一种关系的呼唤都进入了无限。就像在调用Arelation 之后它会再次调用BRelation 和Arelation 再次调用BRelation。我在这里怀疑,也许在你的 B 类上,你已经附加了 BRelation,它产生了这样的结果。

    【讨论】:

    • 谢谢,我会编辑我的问题,但这个错字不在原始代码中。我逐字逐句写了这个问题。
    猜你喜欢
    • 2022-06-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-02-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多