|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits              [2009-05-28 17:39 UTC] christopher dot jones at oracle dot com
  [2009-05-29 03:56 UTC] gonzalo123 at gmail dot com
 | |||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 08:00:01 2025 UTC | 
Description: ------------ When I try to insert a space ' ' in a table with a not null value PDO_OCI throws an ORA-01400: cannot insert NULL exception. I know Oracle uses blank spaces as nuls but in this example there is not a blank space. I realice that the same problem occurs not only with a ' '. Even with more spaces. It looks that trims the value before send it to the database ('1 ' => '1'). Reproduce code: --------------- <?php // create table WEB.TBLDUMMY (COL1 VARCHAR2(3) not null) $db = new PDO( $dsn, // my DB dsn $user, // database username $password); // database password try { $db->setAttribute(PDO::ATTR_AUTOCOMMIT, false); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $db->beginTransaction(); $stmt = $db->prepare("INSERT INTO WEB.TBLDUMMY (COL1) VALUES (:COL1)"); $stmt->bindValue(':COL1', ' '); $stmt->execute(); $db->commit(); } catch (Exception $e) { echo $e->getMessage(); } Expected result: ---------------- Nothing. The script must finish without output Actual result: -------------- SQLSTATE[HY000]: General error: 1400 OCIStmtExecute: ORA-01400: cannot insert NULL into ("WEB"."TBLDUMMY"."COL1") (/opt/PDO_OCI-1.0/oci_statement.c:142)