Skip to content

Oracle clob插入时判断长度需要转一下字节数 #15

@fengyunsmile

Description

@fengyunsmile

最近开发遇到插入数据类型是clob,文字数接近2000个的时候报ORA-01461: 仅能绑定要插入 LONG 列的 LONG 值。查到最后发现 用执行sql 传入OracleParameter 设置类型为 clob 时可以插入。看了下代码发现有判断字符串大于4000时设置为clob,不过由于oracle 默认字符集是AL32UTF8的,2000左右长度文字转换后字节数大于4000,报出了这个错,所以这边应该转一下字节数进行判断。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions