简体   繁体   English

尝试将CLOB类型的列添加到DB2中的表

[英]Trying to add column of CLOB type to table in DB2

I need to add a column of type "CLOB" to the existing table in the database, so I am using the below query: 我需要向数据库中的现有表添加“ CLOB”类型的列,因此我正在使用以下查询:

alter table foldet add("FOLDER_FIELD_VALUE_TWO" CLOB);

but I am getting the below error 但我收到以下错误

Error starting at line : 5 in command - alter table foldet add("FOLDER_FIELD_VALUE_TWO" CLOB) Error report - SQL Error: DB2 SQL Error: SQLCODE=-104, SQLSTATE=42601, SQLERRMC=CLOB;DER_FIELD_VALUE_TWO";JOIN , DRIVER=3.63.75 错误从第5行开始-命令-alter table foldet add(“ FOLDER_FIELD_VALUE_TWO” CLOB)错误报告-SQL错误:DB2 SQL错误:SQLCODE = -104,SQLSTATE = 42601,SQLERRMC = CLOB; DER_FIELD_VALUE_TWO“; JOIN,DRIVER = 3.63 .75

How to add a column to the table? 如何在表中添加列?

You don't say what DB2 version or platform sends the error response, but the SQLSTATE/SQLCODE values should be consistent across essentially all of them. 您没有说什么DB2版本或平台发送错误响应,但是SQLSTATE / SQLCODE值实际上在所有它们之间都应该是一致的。 Looking up SQLSTATE 42501 in DB2 for i 7.2 , the given reason is: DB2 for i 7.2中查询 SQLSTATE 42501,给定的原因是:

  • The authorization ID does not have the privilege to perform the specified operation on the identified object. 授权ID没有特权对标识的对象执行指定的操作。

IOW, you don't have sufficient authority to change the structure of the table when you connect with the userid that received the error. IOW,当您与收到错误的用户ID连接时,您没有足够的权限来更改表的结构。

SQLSTATE 42501 is from you latest comment. SQLSTATE 42501来自您最新的评论。 From your question, SQLSTATE 42601 is: 从您的问题来看,SQLSTATE 42601是:

  • A character, token, or clause is invalid or missing. 字符,标记或子句无效或丢失。

Your comment describes how you cleared that up, and the answer from @SimeonVanov correctly addresses that. 您的评论描述了您如何清除此问题,@ SimeonVanov的回答正确解决了该问题。

ALTER TABLE table_name ALTER TABLE table_name

ADD column_name datatype ADD column_name数据类型

This is the syntax for adding column to a table. 这是用于将列添加到表的语法。 So if you get rid of the brackets I think it should be ok. 因此,如果您摆脱括号,我认为应该没问题。

You're getting the error ( -551 ) because you don't have the ALTER authority on the table. 您收到错误( -551 ),因为您在表上没有ALTER权限。 It's all there in the error message, as shown in the manual. 如手册中所示,所有错误消息均已存在。

SQL Error: SQLCODE=-551, SQLSTATE=42501, SQLERRMC=IPASS;ALTER TABLE;FOLDET, DRIVER=3.63.75
                   ^^^^                           ^^^   ^^^^^^^^^^    ^^^
                error code                       user   privilege    table 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM