案例陈述中的语法错误 [英] Syntax error in the case statment

查看:82
本文介绍了案例陈述中的语法错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对此部分代码有疑问。当我将select statenet放在一个字符串变量中时,我在RTRIM处得到一个语法错误。可以在一个字符串变量中使用Case部分我想知道


Cust_Org_Name =

CASE当C.CustomerType =''+''我'+ ''那么RTRIM(CL.Lastname)

当C.CustomerType =''+''E''+''那么RTRIM(CL.Customername)

END,


感谢你的帮助

解决方案

有一点很突出。

我认为这......那么......应该是这个......然后......即你需要一个''和那之间的空格,因为上面的代码是


CASE当C.CustomerType = ITHEN RTRIM(CL.Lastname)当C.CustomerType = ETHEN RTRIM(CL.Customername)END,


没有像ITHEN或ETHEN这样的命令因此你得到语法错误


哦,没有理由你不能做你想做的事。

您提供的信息让您对自己的工作感到有些困惑,但有足够的信息表明您并没有尝试做一些无法做到的事情。


< blockquote>刚刚找到你的其他相关帖子,所以我也给了答案。

希望有帮助


I am have a problem with this section of code. When I place the select statemnet in a string variable i get an syntax error at RTRIM. Can the Case section be used in a string variable i am wondering

Cust_Org_Name =
CASE WHEN C.CustomerType =''+''I''+''THEN RTRIM(CL.Lastname)
WHEN C.CustomerType = ''+''E''+''THEN RTRIM(CL.Customername)
END,

Thanks for your assistance

解决方案

One thing that stands out.
I think this ...''THEN... should be this ...'' THEN... ie you need a space between '' and THEN because the above code comes out as

CASE WHEN C.CustomerType =ITHEN RTRIM(CL.Lastname) WHEN C.CustomerType = ETHEN RTRIM(CL.Customername) END,

There is no such command as ITHEN or ETHEN and therefore you get a syntax error


Oh, and there is no reason you can''t do what you are trying to do.
The info you provide leaves a bit puzzled at what you are doing but there is enough info to show that you are not trying to do something that can''t be done.


Just found your other post relating to this so I put an answer there also.
Hope it helps


这篇关于案例陈述中的语法错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆