douwen9534
2011-09-13 14:30
浏览 280

OCI_CONNECT是否会导致ORA-01438:值大于此列允许的指定精度?

I'm wondering if oci_connect() can cause a 1438 error, because i get this all the time:

Warning: oci_connect() [function.oci-connect]: ORA-00604: error occurred at recursive SQL level 1 ORA-01438: value larger than specified precision allowed for this column ORA-06512: at line 8 in /xxxxxx/some.php on line 220

It's not depending on which table is being queried. It seems like oci_connect() is inserting some trackingstaff in some sys table, or maybe a trigger is related with the logon. But i don't have the permission to figure out this problem in sys.

Any Idea what could be the cause for this error?

Update

Does oracle do some logging somewhere automatically out of box without configured to specifically? Can i somehow let oracle or PHP show me which table or column is affected?

Update I found out that, when i call the PHP Script in Bash directly, it does work fine. But a call from web will cause titled problem. Any Idea?

图片转代码服务由CSDN问答提供 功能建议

我想知道oci_connect()是否会导致1438错误,因为我总是得到这个:

警告:oci_connect()[function.oci-connect]:ORA-00604:错误 发生在递归SQL级别1 ORA-01438:大于 指定的值 此列ORA-06512允许的精度:第220行 /xxxxxx/some.php第8行

这不取决于查询的是哪个表 。 似乎oci_connect()在某些sys表中插入了一些trackingstaff,或者触发器与登录有关。 但我没有权限在sys中找出这个问题。

任何想法可能导致此错误的原因是什么?

< strong>更新

oracle是否在没有专门配置的情况下自动在某处自动进行某些日志记录? 我可以以某种方式让oracle或PHP向我显示哪个表或列受到影响吗?

更新 我发现当我直接在Bash中调用PHP脚本时 ,它确实工作正常。 但来自网络的电话会引起标题问题。 有什么想法?

  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • duangejian6657 2011-10-17 13:36
    已采纳

    The message error occurred at recursive SQL level 1 suggests to me that the error is arising within a trigger. My guess is that there is an AFTER LOGON ON SCHEMA or DATABASE trigger, and for some reason it causes an error when your web server process attempts to connect.

    Here's an example of how to generate the error you're getting. I have a table called TINY, with a single column that can only take values up to 99:

    SQL> desc tiny;
     Name                                      Null?    Type
     ----------------------------------------- -------- ----------------------------
     N                                                  NUMBER(2)
    

    Now let's create a user account and verify that they can connect:

    SQL> create user fred identified by fred account unlock;
    
    User created.
    
    SQL> grant connect to fred;
    
    Grant succeeded.
    
    SQL> connect fred/fred
    Connected.
    

    Good - let's log back in as me and create a trigger that will cause an error if FRED attempts to connect:

    SQL> connect luke/password
    Connected.
    SQL> create or replace trigger after_logon_error_if_fred
      2    after logon on database
      3  begin
      4    if user = 'FRED' then
      5      insert into tiny (n) values (100);
      6    end if;
      7  end;
      8  /
    
    Trigger created.
    

    Recall that our TINY table can only store values up to 99. So, what happens when FRED attempts to connect?

    SQL> connect fred/fred
    ERROR:
    ORA-00604: error occurred at recursive SQL level 1
    ORA-01438: value larger than specified precision allowed for this column
    ORA-06512: at line 3
    
    

    Other than the line number, and the bit PHP added, that's exactly the message you got.

    If you want to see whether there are any AFTER LOGON triggers in your database, try running the query

    SELECT trigger_name, owner FROM all_triggers
     WHERE TRIM(triggering_event) = 'LOGON';
    

    On my database (Oracle 11g XE beta), I get the following output:

    TRIGGER_NAME                   OWNER
    ------------------------------ ------------------------------
    AFTER_LOGON_ERROR_IF_FRED      LUKE
    

    I don't believe Oracle does any logging out-of-the-box, and I'd be surprised if PHP's oci_connect does either.

    I can only speculate as to why the error arises only for your web server and not when you run PHP from a bash script. Perhaps the trigger is querying V$SESSION and trying to figure out what user account is trying to connect to the database?

    已采纳该答案
    评论
    解决 无用
    打赏 举报
  • dongyan5141 2011-09-13 14:34

    Well, depending on the column, you're either trying to insert a number that's larger than the allowed bounds for a numeric column, or you're trying to insert a string into a varchar2(n) column that is longer than n characters. Here are more specifics on Oracle datatypes.

    Without more specific information as to what's being inserted into what column in what table at line 220 of some.php, I can't be of much more direct help.

    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题