The second argument for 'concat' must be a string or a char

我在DolphinDB中执行下列代码:



报错:The second argument for 'concat' must be a string or a char。其中yearOfRegistration和monthOfRegistration两个字段的类型都是INT。数据如下图所示:

attachments-2021-06-V7xdOdl560c81be545d3a.png

请问怎么解决?



请先 登录 后评论

1 个回答

logger

参阅用户手册中concat的说明,第二个参数只能是字符串或字符。你在计算concat(concat(string(yearOfRegistration),"."),string(monthOfRegistration))这个时,第二个参数值是string(monthOfRegistration),这个是字符串向量了,所以报错。可试试下面代码:

select string(yearOfRegistration) + "." + string(monthOfRegistration) + ".01" as newcat from tb
请先 登录 后评论