首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Db2约束查询提供错误

Db2约束查询提供错误
EN

Stack Overflow用户
提问于 2011-12-20 10:23:19
回答 1查看 1.1K关注 0票数 0

我试图在我的DB2表中添加以下约束,但这会导致错误。

代码语言:javascript
复制
    ALTER TABLE Table_name ADD CONSTRAINT VALID_BINDING 
    CHECK((LOWER(REQ_BINDING) IN ('http-post','http-redirect'))
    AND ((LOWER(RESP_BINDING) IN ('http-post','http-redirect')));

错误堆栈跟踪

代码语言:javascript
复制
DB21034E  The command was processed as an SQL statement because it was not a 
valid Command Line Processor command.  During SQL processing it returned:
SQL0104N  An unexpected token "END-OF-STATEMENT" was found following "',
'http-redirect')))".  Expected tokens may include:  ")".  SQLSTATE=42601

SQL0104N  An unexpected token "END-OF-STATEMENT" was found following "','http-redirect')))".  Expected tokens may include:  ")                               ".

Explanation: 

A syntax error in the SQL statement or the input command string 
for the SYSPROC.ADMIN_CMD procedure was detected at the specified 
token following the text "<text>".  The "<text>" field indicates 
the 20 characters of the SQL statement or the input command 
string for the SYSPROC.ADMIN_CMD procedure that preceded the 
token that is not valid.  

 As an aid, a partial list of valid tokens is provided in the 
SQLERRM field of the SQLCA as "<token-list>".  This list assumes 
the statement is correct to that point.  

 The statement cannot be processed. 
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2011-12-20 11:53:26

括号漏掉了。

代码语言:javascript
复制
ALTER TABLE Table_name ADD CONSTRAINT VALID_BINDING 
    CHECK((LOWER(REQ_BINDING) IN ('http-post','http-redirect'))
    AND ((LOWER(RESP_BINDING) IN ('http-post','http-redirect'))));
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/8573964

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档