select account_id ...... from account where account_id = XXX
如果查询的字段为空或者数据不存在,查询给出一个默认值,是怎么写的?
db是Oracle
[code="java"]SELECT (
CASE WHEN account_id= ''
THEN 'empty'
when account_id is null
then 'empty'
ELSE account_id
END
) account_id
FROM account
WHERE account_id = 'XXX' OR account_id ='' OR (account_id is NULL)[/code]
就是这个上面那个case语句