0

我从 SQL(访问)开始

IIf(Len([CAT]) < 3, 
Left([CAT],1) & 0 & Right([CAT],1),
[CAT]) AS CAT1, 
[HD0] &

IIf([TABLE].[HD1]<>"00",
" / " & [HD1_ABR],
Null) & 
IIf([HD2]<>"00",
" / " & [HD2_NAME],
Null) & 
IIf([HD3]<>"000",
" / " & [HD3_NAME],
Null) & 
IIf([HD4]<>"00",
" / " & [HD4_NAME]) AS NAME,

并做了Oracle(Sql Developer)

Case
When length(cat) < 3
Then SubStr(cat,1,1) || '0' || SubStr(cat,-1,1)
Else cat
End cat1,hd0
Case
When TABLE <>"00"
then " / "
else HD1_ABR,null

当我在 SQLDev 中运行查询时,在命令行出现错误错误:9 列:4 错误报告:SQL 错误:ORA-00923:在预期的位置找不到 FROM 关键字 00923。00000 -“在预期的位置找不到 FROM 关键字”

4

1 回答 1

2

MS Access syntax is entirely different to Oracle syntax. No square brackets, and different names for the SQL functions. http://docs.oracle.com/cd/E11882_01/server.112/e17118/functions.htm#SQLRF006

 Case
   When length(cat) < 3
   Then SubStr(cat,1,1) || '0' || SubStr(cat,-1,1)
   Else cat
 End cat1
于 2013-03-19T17:49:14.110 回答