Musisz utworzyć tymczasowy obiekt blob za pomocą DBMS_LOB.createtemporary
:
SQL> CREATE OR REPLACE FUNCTION CONCAT_BLOB(A IN BLOB, B IN BLOB) RETURN BLOB IS
2 C BLOB;
3 BEGIN
4 dbms_lob.createtemporary(c, TRUE);
5 DBMS_LOB.APPEND(c, A);
6 DBMS_LOB.APPEND(c, B);
7 RETURN c;
8 END;
9 /
Function created
Wtedy powinieneś być w stanie użyć go w oświadczeniu o aktualizacji:
SQL> CREATE TABLE t (a BLOB, b BLOB, c BLOB);
Table created
SQL> INSERT INTO t VALUES
2 (utl_raw.cast_to_raw('aaa'), utl_raw.cast_to_raw('bbb'), NULL);
1 row inserted
SQL> UPDATE t SET c=CONCAT_BLOB(a,b);
1 row updated
SQL> SELECT utl_raw.cast_to_varchar2(a),
2 utl_raw.cast_to_varchar2(b),
3 utl_raw.cast_to_varchar2(c)
4 FROM t;
UTL_RAW.CAST_TO_VARCHAR2(A UTL_RAW.CAST_TO_VARCHAR2(B UTL_RAW.CAST_TO_VARCHAR2(C
-------------------------- -------------------------- --------------------------
aaa bbb aaabbb