|
Операция "умножения" в SQL DB2
|
|||
---|---|---|---|
#18+
Здравствуйте, подскажите пожалуйста как в DB2 выполнять математические операции в sql-скриптах. Ниже представлен пример по умножению: SELECT prod_id, quantity, item_price quantity*item_price AS expanded_price FROM OrderItems WHERE order nam = 20008; ------------------------------------------------------------------------------ SELECT prod_id, quantity, item_price quantity*item_price AS expanded_price FROM OrderItems WHERE order nam = 20008 SQL0104N An unexpected token "*" was found following "item_price quantity". Expected tokens may include: ",". SQLSTATE=42601 SQL0104N An unexpected token "*" was found following "item_price quantity". Expected tokens may include: ", ". Explanation: A syntax error in the SQL statement was detected at the specified token following the text "<text>". The "<text>" field indicates the 20 characters of the SQL statement that preceded the token that is not valid. As an aid to the programmer, 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. User Response: Examine and correct the statement in the area of the specified token. sqlcode : -104 sqlstate : 42601 ... |
|||
:
Нравится:
Не нравится:
|
|||
26.01.2010, 08:14 |
|
Операция "умножения" в SQL DB2
|
|||
---|---|---|---|
#18+
Добрый день. make123подскажите пожалуйста как в DB2 выполнять математические операции в sql-скриптах. Ниже представлен пример по умножению: SELECT prod_id, quantity, item_price, quantity*item_price AS expanded_price FROM OrderItems WHERE order nam = 20008; ------------------------------------------------------------------------------ SELECT prod_id, quantity, item_price quantity*item_price AS expanded_price FROM OrderItems WHERE order nam = 20008 SQL0104N An unexpected token "*" was found following "item_price quantity". Expected tokens may include: ",". SQLSTATE=42601 SQL0104N An unexpected token "*" was found following "item_price quantity". Expected tokens may include: ", ". ...Пропущена запятая. Кроме того, если у вас действительно поле 'order nam' заведено с пробелом, то его надо в двойные кавычки заключать. ... |
|||
:
Нравится:
Не нравится:
|
|||
26.01.2010, 09:41 |
|
|
start [/forum/topic.php?fid=43&msg=36430629&tid=1602929]: |
0ms |
get settings: |
10ms |
get forum list: |
15ms |
check forum access: |
5ms |
check topic access: |
5ms |
track hit: |
166ms |
get topic data: |
13ms |
get forum data: |
3ms |
get page messages: |
44ms |
get tp. blocked users: |
2ms |
others: | 15ms |
total: | 278ms |
0 / 0 |