2011-12-20 4 views
0

Я пытаюсь добавить следующее ограничение в таблицу DB2, но оно дает ошибку.Ошибка запроса ограничения Db2

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'))); 

стек ошибок трассировки

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. 
+1

Вам не хватает закрывающего кронштейна. –

+1

Возможный дубликат оператора [AND в ограничениях DB2] (http://stackoverflow.com/questions/8574840/and-operator-in-db2-constraints) –

ответ

1

Скобки пропустил.

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')))); 
Смежные вопросы