laravel-oci8
laravel-oci8 copied to clipboard
[5.3] ORA-01438: value larger than specified precision allowed for this column.
Error:
- ORA-01438: value larger than specified precision allowed for this column.
- The id column generated by migrate
number (10) - If I increase the size (32) of the column the assigned value is
1971389988927and not the id25

In OracleProcessador.php If I change the code and return only PDO:PARAM_STR the insert works
private function getPdoType( $value ) {
return PDO::PARAM_STR;
}
or convert values to string in bindValues
private function bindValues( &$values, $statement, $parameter ) {
$count = count( $values );
for ( $i = 0; $i < $count; $i++ ) {
if ( is_object( $values[ $i ] ) ) {
$values[ $i ] = (string)$values[ $i ];
}
if ( is_bool( $values[ $i ] ) ) {
$values[ $i ] = (string)$values[ $i ];
}
if ( is_int( $values[ $i ] ) ) {
$values[ $i ] = (string)$values[ $i ];
}
$type = $this->getPdoType( $values[ $i ] );
$statement->bindParam( $parameter, $values[ $i ], $type );
$parameter++;
}
return $parameter;
}
But this is not the correct implementation.
Is it missing any configuration in the database to accept the pdo typing?
Migration:
Schema::create( 'schedules', function ( Blueprint $table ) {
$table->increments( 'id' );
$table->string( 'name', 63 )->nullable();
} );
Table created:

Create Sequence:
create sequence schedules_id_seq
minvalue 1
maxvalue 9999999999
start with 1
increment by 1
nocache
cycle;
Model:
class Schedule extends Model {
protected $table = 'schedules';
public $sequence = 'schedules_id_seq';
protected $dates = [
'updated_at',
'created_at',
'previous_planned_run',
'previous_run',
'next_planned_run',
];
protected $fillable = [
'id',
'name',
'description',
'command',
'cron',
'filename_log',
'active',
'updated_at',
'created_at',
'previous_planned_run',
'previous_run',
'next_planned_run',
];
protected $casts = [
'active' => 'boolean',
];
....
Save model:
$schedule = new Schedule();
$schedule->name = 'xx';
$schedule->save();
Query Generate
insert into "SCHEDULES4" ("ACTIVE", "ID") values (?, ?) returning "ID" into ?
$binding = [0,25,2]
Composer.json:
"laravel/framework": "5.3.*",
"yajra/laravel-oci8": "5.3.*"
php 5.6.21
extension - php_oci8_11g.dll - File version 5.6.24
Oracle 11.2.0.1.0
I tried to replicate the issue on Laravel 5.4 and it's all working fine on my side. Will try to setup Laravel 5.3 when I had the chance. This might be an issue on 5.3. Thanks!
BTW, if you can, please do not hesitate a PR for a possible fix if this is indeed a bug. Thanks!
do you use zend server?
Same error am also getting @johnathansantos found solution?
I also got the same error https://github.com/yajra/laravel-oci8/issues/552
Solved by changing oci8 version from 2.0.10 to 2.0.8
This issue is stale because it has been open for 30 days with no activity.
This issue was closed because it has been inactive for 7 days since being marked as stale.