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

我在DolphinDB中执行下列代码:

db = database("dfs://transport")

tb = select top 1000 * from db.loadTable(`autos)

select concat(concat(concat(string(yearOfRegistration),"."),string(monthOfRegistration)),".01") as newcat from tb

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

请问怎么解决?

回答

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

select string(yearOfRegistration) + "." + string(monthOfRegistration) + ".01" as newcat from tb

以上是 The second argument for 'concat' must be a string or a char 的全部内容, 来源链接: utcz.com/a/36012.html

回到顶部