【问题标题】:Oracle, how to insert LONG RAW (a hex string is much longer than 32767) into BLOB in a queryOracle,如何在查询中将 LONG RAW(十六进制字符串比 32767 长得多)插入 BLOB
【发布时间】:2021-03-26 12:44:37
【问题描述】:

对于十六进制字符串

DECLARE buf RAW(32767);
BEGIN
buf := hextoraw('3082560E3082488E1B02....');
INSERT INTO FINGERPRINT VALUES ('bff17a2c-49b7-4d6c-9c4e-56cb1d35c8c8', '00003', 2, buf, NULL);
END;

如果字符串长度超过 32767,如何做同样的事情?我尝试使用 LONG RAW 而不是 RAW(32767) 但出现错误:

Error report -
ORA-06502: PL/SQL: numeric or value error
ORA-06512: at line 1
06502. 00000 -  "PL/SQL: numeric or value error%s"
*Cause:    An arithmetic, numeric, string, conversion, or constraint error
           occurred. For example, this error occurs if an attempt is made to
           assign the value NULL to a variable declared NOT NULL, or if an
           attempt is made to assign an integer larger than 99 to a variable
           declared NUMBER(2).
*Action:   Change the data, how it is manipulated, or how it is declared so
           that values do not violate constraints.

【问题讨论】:

    标签: database oracle sql-insert


    【解决方案1】:

    引用asktom:

    在 Oracle8i 8.0 及更高版本中,您不应该使用 LONG RAW。 LONG 和 LONG RAW 都只是为了向后兼容而提供的——它们是不推荐使用的数据类型。 您应该使用 blob

    如果仍然产生错误,请尝试使用:

    • dbms_lob.createtemporary

    然后

    • dbms_lob.append

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-03-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-07-06
      • 2014-01-04
      • 2016-01-27
      相关资源
      最近更新 更多