problem inserting Unicode data "ORA-01461: can bind a LONG value only ..."
445518Nov 9 2006 — edited Nov 29 2006I am running Oracle 10g Express Edition, PHP 5.1.6 and Apache 2.0.59 on a Windows XP machine.
I have the following table:
CREATE TABLE test1
(
tid NUMBER
CONSTRAINT test1_pk PRIMARY KEY,
col1 VARCHAR2(255),
col2 NVARCHAR2(255),
col3 VARCHAR2(4000),
last_modified TIMESTAMP DEFAULT SYSTIMESTAMP
);
I can insert Unicode data into the following table WITHOUT using binding, e.g. this works:
// Program output here
QUERY = INSERT INTO test1 VALUES (test1_seq.nextval, 'ユニコードは、すべての', 'ユニコードは、すべての', 'ユニコードは、すべての', SYSTIMESTAMP)
// End program output
But when I try using bind, I get an error message as follows:
// Program output here
QUERY = INSERT INTO test1 VALUES (test1_seq.nextval, :col1, :col2, :col3, SYSTIMESTAMP)
Warning: ociexecute() [function.ociexecute]: ORA-01461: can bind a LONG value only for insert into a LONG column in C:\Program Files\Apache Group\Apache2\htdocs\form9_BIND.php on line 60
// End program output
The PHP code looks like this:
// PHP code
$query1 = "INSERT INTO test1 VALUES (test1_seq.nextval, :col1, :col2, :col3, SYSTIMESTAMP)";
echo 'QUERY = ' . $query1;
$s = OCIParse($c, $query1);
OciBindByName($s, ":col1", $col1,32);
OciBindByName($s, ":col2", $col2,32);
OciBindByName($s, ":col3", $col3,32);
OCIExecute($s, OCI_DEFAULT);
// End of PHP code
Any ideas what the problem is? The text works fine with simpler input, e.g. this works:
// Program output
INSERT INTO test1 VALUES
(test1_seq.nextval, 'Iñtërnâtiônàlizætiøn', 'Iñtërnâtiônàlizætiøn', 'Iñtërnâtiônàlizætiøn', SYSTIMESTAMP)
// End program output