类型为numeric的输入语法无效

时间:2015-08-18 18:05:47

标签: sql regex postgresql

这是我正在使用的查询 -

select
    cast(date_time as date) dt,
    visit,
    visitor,
    regexp_replace(item_id ,'[^0-9]','','g') as item_id,
    sum(qty) as qty,
    sum(sales) as sales
from
( 
    select
        date_time,
        (string_to_array(x,';'))[2] as item_id,     
        cast((string_to_array(x,';'))[3] as decimal(18,0)) qty, 
        cast((string_to_array(x,';'))[4] as decimal(18,0)) sales,                                                
        visit,
        visitor
    from

    TABLE

) b
where item_id is not null and (item_id ~ '^[0-9]+$')= 't'
group by 1,2,3,4 ;

之前运行正常。

最近我开始收到一条错误消息,其中包含以下内容 -

  

类型为数字的无效输入语法

0 个答案:

没有答案