Cakephp 2.5找不到Oracle序列

问题描述 投票:0回答:1

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

通过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 / cache内容之后,我也会看到同样的错误,就好像cakephp尝试猜测序列名称一样,即使以正确的方式命名了sequence属性。

有没有办法看出它为什么会发生?

oracle cakephp
1个回答
1
投票

很明显,你的oracle架构中没有一个名为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;
© www.soinside.com 2019 - 2024. All rights reserved.