Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I am trying to execute below query in vertica:

select 
case when count(*) = 0 then #{aaa} || #{bbb}
else
 trim(cast(max(ccc)+1 as intger))
end
 as ccc
from apple where aaa = #{aaa}

Query is getting expected results in tera but in Vertica Getting error. How can I do this?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
432 views
Welcome To Ask or Share your Answers For Others

1 Answer

Check the Vertica docu: https://www.vertica.com/docs/10.0.x/HTML/Content/Authoring/SQLReferenceManual/Functions/String/BTRIM.htm

BTRIM() removes the blank characters (by default, if not specified as the second parameter) from a passed string. You can't BTRIM() a number.

Why would you want to trim an integer, in trim(cast(max(ccc)+1 as int**e**ger)) ? It makes no sense at all!. Teradata should complain, too.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...