SQLSTATE [HY000]:常规错误:1405 OCIStmtFetch:ORA-01405:列值为NULL (/opt/oci/PDO_OCI-1.0/oci_statement.c:446) 正在执行的SQL是:WITH USER_SQL AS(SELECT * FROM“devices”), PAGINATION AS(SELECT USER_SQL。*,rownum as rowNumId FROM USER_SQL) 选择 * 来自PAGINATION rownum< = 20 错误信息:数组 ( [0] => HY000 [1] => 1405 [2] => OCIStmtFetch:ORA-01405:列值为NULL (/opt/oci/PDO_OCI-1.0/oci_statement.c:446) ) ↵ 引起:PDOException
SQLSTATE [HY000]:一般错误:1405 OCIStmtFetch:ORA-01405:pobranąwartościąkolumnyjest NULL (/opt/oci/PDO_OCI-1.0/oci_statement.c:446)
在/var/www/html/vendor/yiisoft/yii2/db/Command.php第829行
当我把这个选择放入sql浏览器时,它在xampp oracle db& Windows,但不是生产CentOS 6.1和apache2 oracle db 11 请帮忙
答案 0 :(得分:0)
尝试在oracle中使用nvl函数。对于包含clob列的模型。而是使用sql数据提供程序。
例如。在控制器动作索引中使用yii2中的数据提供程序
$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,
]);