oci_execute():ORA-01461:只能插入LONG值才能插入LONG列

时间:2016-04-21 14:48:25

标签: php sql oracle data-binding

我不明白错误告诉我的是什么。我没有插入任何LONG数据,为什么我收到错误oci_execute(): ORA-01461: can bind a LONG value only for insert into a LONG column

这是我的代码:

$sql = "INSERT INTO contacts (id, fname, lname, position, email, created_date, created_by, updated_date, updated_by)
    VALUES (contacts_seq.NEXTVAL, :firstname, :lastname, :position, :email, sysdate, :user_id, NULL, NULL)";

$stmt = oci_parse($conn, $sql);

oci_bind_by_name($stmt, ":firstname", $firstname);
oci_bind_by_name($stmt, ":lastname", $lastname);
oci_bind_by_name($stmt, ":position", $position);
oci_bind_by_name($stmt, ":email", $email);
oci_bind_by_name($stmt, ":user_id", $user_id);

while(($data = fgetcsv($resource)) !== false) {
    if($row === 1) {
        # Skip the first row since they are only headers.
        $row++;
        continue;
    } else {
        $firstname = str_replace("\n", " ", trim($data[0]));
        $lastname = str_replace("\n", " ", trim($data[1]));
        $position = str_replace("\n", " ", trim($data[2]));
        $email = str_replace("\n", " ", trim($data[3]));

        oci_execute($stmt, OCI_DEFAULT);
    }
}

oci_commit($objConn);
oci_free_statement($stmt);

对我来说没有意义,因为我绑定的所有变量都是strings

其他信息

唯一的LONG列是id,因为它是INTEGER。其他列均为VARCHAR2DATE

0 个答案:

没有答案