Update Clob字段 SP最终版
1
PROCEDURE INVHL_UPDATE_CLOB_DATA(
2
p_table_name IN VARCHAR2,
3
p_clob_field_name IN VARCHAR2,
4
p_where_condition IN VARCHAR2,
5
p_position IN NUMBER,
6
p_clob_data IN VARCHAR2 )
7
/*表名table_name,
8
clob字段名field_name
9
确定要更新唯一记录的where条件p_where_condition
10
开始处理字符的位置p_position,
11
传入的字符串变量P_clob_data*/
12
IS
13
v_lobloc CLOB;
14
v_clob_data VARCHAR2( 32767 );
15
v_amount BINARY_INTEGER;
16
v_position BINARY_INTEGER;
17
v_query_string VARCHAR2( 1000 );
18
BEGIN
19
v_position := p_position * 32766 + 1;
20
v_amount := LENGTH( p_clob_data );
21
v_clob_data := p_clob_data;
22
v_query_string :=
23
'SELECT '
24
|| p_clob_field_name
25
|| ' FROM '
26
|| p_table_name
27
|| ' WHERE '
28
|| p_where_condition
29
|| ' FOR UPDATE';
30
dbms_output.put_line(v_query_string);
31
--initialize buffer with data to be inserted or updated
32
EXECUTE IMMEDIATE v_query_string
33
INTO v_lobloc;
34![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
35
--from pos position, write 32766 varchar2 into lobloc
36
DBMS_LOB.WRITE( v_lobloc,
37
v_amount,
38
v_position,
39
v_clob_data );
40
COMMIT;
41
EXCEPTION
42
WHEN OTHERS THEN
43
ROLLBACK;
44
END;
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
2
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
3
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
4
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
5
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
6
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
7
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
8
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
9
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
10
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
11
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockEnd.gif)
12
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
13
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
14
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
15
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
16
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
17
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
18
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
19
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
20
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
21
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
22
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
23
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
24
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
25
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
26
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
27
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
28
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
29
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
30
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
31
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
32
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
33
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
34
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
35
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
36
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
37
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
38
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
39
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
40
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
41
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
42
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
43
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
44
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)