Home > database >  Oracle dbms_lob. Append strange problems
Oracle dbms_lob. Append strange problems

Time:09-17


Dbms_lob. Createtemporary (v_cursor, true);
Dbms_lob. Append (v_cursor, '12345');

Return v_cursor;

The output is 12, joining together the incomplete what reason be

CodePudding user response:

A complete example stick out
 create or replace function test_1905101 return varchar2 is 
V_str clob.
The begin
Dbms_lob. Createtemporary (v_str, true);
Dbms_lob. Append (v_str, '12345');
Return (v_str);
The end;

The select test_1905101 () from dual;

CodePudding user response:

The create or replace function test2 return clob is
V_clob CLOB.
The begin
DECLARE
V_char VARCHAR2 (100);
The BEGIN
V_char:='123456';
Dbms_lob. Createtemporary (v_clob, TRUE);
Dbms_lob. Append (v_clob v_char);
-- dbms_output. Put_line (v_clob);
end;
Return v_clob;
END test2.
Return v_clob is 123, if is to perform output output 123456

CodePudding user response:

Say your calls

 
SQL>
SQL> The create or replace function test2 return clob is
2 v_clob CLOB.
3 the begin
4 DECLARE
5 v_char VARCHAR2 (100);
6 the BEGIN
7 v_char:='123456';
8 dbms_lob. Createtemporary (v_clob, TRUE);
9 dbms_lob. Append (v_clob v_char);
10 the end;
11 return v_clob;
12 END test2;
13/
The Function created
SQL> The set serverout on;
SQL> Declare
2 c clob;
3 d clob;
4 the begin
5 the select test2 into c from dual;
6 dbms_output. Put_line (' c='| | c);
7 d:=test2;
8 dbms_output. Put_line (' d='| | d);
9 the end;
10/
C=123456
D=123456
PL/SQL procedure successfully completed
SQL> The drop function test2.
The Function dropped

SQL>
  • Related