English 中文(简体)
利用CLOBQ进行数据更新吗?
原标题:Is it possible to update data inside a CLOB using SQL?

I have a table having one clob column which has XML data in it. Say I want to replace XYZ with ABC in the clob column. Is it possible using sqlplus?

最佳回答

"i have new line in the column. any advice?"

新路线是属性的;如果你想要修正载有新内容的案文,你需要将这些内容列入搜索范围。 你们可以通过将ASCII作为论据的价值的人权中心这样做。 您需要列入的准确编码根据职业介绍所的不同而有所不同。 因为我在管理系统Windows I上就这样作,所以需要通过双轨(ASCII=10)和回程(ASCII=13)。

SQL> select * from t42
  2  /

TXT
--------------------------------------------------------------------------------
<ABC> ABCD
  </ABC>


SQL>  update t42 set txt=replace(txt, ABCD ||chr(10)||chr(13),  APC woz here )
  2  /

1 row updated.

SQL> select * from t42
  2  /

TXT
--------------------------------------------------------------------------------
<ABC> APC woz here </ABC>

SQL>

顺便说一句,如果你储存XML文本,则可能值得使用XMLType数据类型,而不是CLOB。 它有许多有用的功能。

问题回答

为什么不尝试?

SQL> create table nnn(c1 clob);

Table created.

SQL> insert into nnn values ( text ABC end );

1 row created.

SQL> select * from nnn;

C1
-------------------------------------------------
text ABC end

SQL> update nnn set c1=replace(c1, ABC , XYZ );

1 row updated.

SQL> select * from nnn;

C1
-------------------------------------------------
text XYZ end

SQL>

是的,它有可能发挥一种REPLACE的功能。 Try:

update nnn set c1 = REPLACE(c1, ABC> , XYZ> )




相关问题
Export tables from SQL Server to be imported to Oracle 10g

I m trying to export some tables from SQL Server 2005 and then create those tables and populate them in Oracle. I have about 10 tables, varying from 4 columns up to 25. I m not using any constraints/...

Connecting to Oracle 10g with ODBC from Excel VBA

The following code works. the connection opens fine but recordset.recordCount always returns -1 when there is data in the table. ANd If I try to call any methods/properties on recordset it crashes ...

How to make a one to one left outer join?

I was wondering, is there a way to make a kind of one to one left outer join: I need a join that matches say table A with table B, for each record on table A it must search for its pair on table B, ...

Insert if not exists Oracle

I need to be able to run an Oracle query which goes to insert a number of rows, but it also checks to see if a primary key exists and if it does, then it skips that insert. Something like: INSERT ALL ...

How can I store NULLs in NOT NULL field?

I just came across NULL values in NOT-NULL fields in our test database. How could they get there? I know that NOT-NULL constraints can be altered with NOVALIDATE clause, but that would change table s ...

Type reference scope

I m studying databases and am currently working on a object-relational DB project and I ve encountered a small problem with the number of possible constraints in an object table. I m using "Database ...

OracleParameter and DBNull.Value

we have a table in an Oracle Database which contains a column with the type Char(3 Byte). Now we use a parameterized sql to select some rows with a DBNull.Value and it doesn t work: OracleCommand ...

热门标签