dongye9228
dongye9228
2015-02-24 18:03
浏览 32

Yii 2 Oracle DB错误! 在xampp Windows上工作/不在CentOs Apache2 oracle db上工作

SQLSTATE[HY000]: General error: 1405 OCIStmtFetch: ORA-01405: column value is NULL (/opt/oci/PDO_OCI-1.0/oci_statement.c:446) The SQL being executed was: WITH USER_SQL AS (SELECT * FROM "devices"), PAGINATION AS (SELECT USER_SQL.*, rownum as rowNumId FROM USER_SQL) SELECT * FROM PAGINATION WHERE rownum <= 20 Error Info: Array ( [0] => HY000 [1] => 1405 [2] => OCIStmtFetch: ORA-01405: column value is NULL (/opt/oci/PDO_OCI-1.0/oci_statement.c:446) ) ↵ Caused by: PDOException

SQLSTATE[HY000]: General error: 1405 OCIStmtFetch: ORA-01405: pobraną wartością kolumny jest NULL (/opt/oci/PDO_OCI-1.0/oci_statement.c:446)

in /var/www/html/vendor/yiisoft/yii2/db/Command.php at line 829

When I put this select into sql browser it works perfectly on xampp oracle db & Windows, but not on production CentOS 6.1 and apache2 oracle db 11 Please Help

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • doumao1917
    doumao1917 2015-03-20 06:29

    Try using nvl function in oracle. For model that contain clob column. Using sql data provider instead.

    For example. Using data provider in yii2 in controller action index

    $count = Yii::$app->db->createCommand('
        SELECT COUNT(*) FROM POST
    ')->queryScalar();
    
            $dataProvider = new SqlDataProvider([
                'sql' => "SELECT ID, NVL(TEXT_WITH_CLOB, 'None')  FROM POST",
                'key' => 'ID',
                'totalCount' => $count,
                'sort' => [
                    'attributes' => [
                        'ID',
                        'TEXT_WITH_CLOB',
                    ],
                ],
                'pagination' => [
                    'pageSize' => 20,
                ],
            ]);
    
    return $this->render('index', [
                'dataProvider' => $dataProvider,
            ]);
    
    点赞 评论

相关推荐