How Oracle adds a non-empty column of type CLOB to an empty table

Source: Internet
Author: User

The general step to add a non-empty column is to add a column that can be empty first, and then update that column to a value (such as 0) and finally modify the type

But it's not going to meet the type CLOB. In modify this step times wrong: ora-22296:invalid ALTER TABLE option for conversion of a Long datatype to LOB, so went to the next 22296 Error details: (http://docs . oracle.com/cd/e11882_01/server.112/e17766/e19999.htm#ora-24230)

Cause:an attempt was made to specify ALTER TABLE options which is disallowed during conversion of LONG datatype to L Ob. The only ALTER TABLE options allowed during conversion of a LONG datatype to LOB is the default clause and LOB storage Clau SE for the column being converted to LOB.Action:remove the disallowed options.
Workaround: In update this step: Update tableName Set colname = Empty_clob (); In modify this step: ALTER TABLE TableName modify (colname not NULL); Not the colname clob not NULL, which is different from the general Modify!!!
Example: Alter TABLE Post_info Add (post_content CLOB);
Update Post_info Set post_content = Empty_clob ();
ALTER TABLE Post_info Modify (post_content not NULL);
COMMENT on COLUMN "Dbvop". " Post_info "." Post_content "is
' Notice content ';
commit;---------------In addition: How to change the column syntax of a class that is not NULL CLOB type to NULL: ALTER TABLE tableName modify COLNAME null;

Note: the Empty_blob () and Empty_clob () functions are used to initialize large data type fields.

-----------------How to remove columns with spaces in column names

ALTER TABLE cplnt_workorder drop column "Client_ ISSUE";

-----------------How to modify column names

ALTER TABLE cplnt_workorder rename column "Client_ ISSUE1" to Client_ ISSUE;

http://blog.csdn.net/hjxdreamer/article/details/21230121

How Oracle adds a non-empty column of type CLOB to an empty table

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.