PHP-Oracle Binding

I’ve got a problem on  CakePHP-Oracle when doing INSERT/UPDATE operation to a field with large size text.

The error usually  “string literal too long”.

I’ve tried to use binding which works like a charm (at least until now), here’s the example:

$conn = OCILogon(‘username’, ‘password’, ‘databasename’);
$stmt  = ‘INSERT INTO pegawai(pegawaiid, namapegawai, alamat) ‘;
$stmt .= ‘VALUES(:pid, :nama, :alm)’;

$stid = OCIParse($conn, $stmt);

OCIBindByName($stid, “:pid”,   $f_id , 4);
OCIBindByName($stid, “:nama”, $f_name, -1);
OCIBindByName($stid, “:alm”, $f_address, -1);


The number 4 on the binding pid is the numeric digit width.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s