日期:2014-05-17  浏览次数:20764 次

这条SQL语句在SQL SERVER 2000中可以执行,在ORACLE 9i中怎样改动才能执行呢?
select   a.keyword,a.keyalias,a.key_doc
,a.keyword+(CASE   WHEN   a.keyalias   IS     NULL   THEN     ' '   else   '\\ '+a.keyalias     END)+(CASE   WHEN   a.key_doc   IS     NULL   THEN   ' '   else     ': '+a.key_doc     END)  

from     myTableName     a

------解决方案--------------------
select a.keyword,
a.keyalias,
a.key_doc,
a.keyword || decode(a.keyalias, NULL, ' ', '\\ ' || a.keyalias) ||decode(a.key_doc, NULL, ' ', ': ' || a.key_doc)
from myTableName a
------解决方案--------------------
select a.keyword,
a.keyalias,
a.key_doc,
decode(a.keyalias, null, ' ', '\\ ' || a.keyalias) ||
decode(a.key_doc, null, ' ', ': ' || a.key_doc)
from myTableName a;