Cakephp 2.5 找不到 Oracle 序列



我按照正确的 CakePhp 命名约定创建了一个 CakePhp 模型,并将在 Oracle 数据库上创建的序列名称添加到$sequence属性中。

通过sql plus插入一条记录是可以的,但是通过Cakephp插入数据会触发错误:

[code] => 2289 
[message] => ORA-02289: the sequence does not exists 
[offset] => 7 [sqltext] => SELECT my_sql_table_seq.currval FROM dual 

即使在清理了 tmp/缓存内容之后,我也会看到相同的错误,就好像 cakephp 试图猜测序列名称一样,即使以正确的方式命名序列属性也是如此。

有没有办法看看为什么会发生这种情况?

很明显,您的预言机模式中没有一个名为my_sql_table_seq序列,或者您可能在另一个模式中有此序列
并且您缺少相关的模式名称prefix让我们调用myschemaselect myschema.my_sql_table_seq.currval from dual;

(前提是您的模式被授予执行此序列):

SQL> conn otherschema/password1
SQL> grant execute on my_sql_table_seq to myschema;
SQL> conn myschema/password2
SQL> select otherschema.my_sql_table_seq.currval from dual;

或者只是创建一个序列:

SQL> conn myschema/password2
SQL> create sequence my_sql_table_seq increment by 1 minvalue 0;
SQL> select my_sql_table_seq.currval from dual;

最新更新