Postgres View DDL
От | Sam Stearns |
---|---|
Тема | Postgres View DDL |
Дата | |
Msg-id | CAN6TVj=gp68UdbiWT1n5csgC=KsZojuM6vnt3ZgmKNkmkVeCxQ@mail.gmail.com обсуждение исходный текст |
Ответы |
Re: Postgres View DDL
|
Список | pgsql-sql |
Howdy,
I have an Oracle view that's been converted for Postgres. This block of code in the Oracle view DDL:
TO_NUMBER (NVL (REGEXP_REPLACE (broker_mc, '[^0-9]+', ''), 0)),
TO_NUMBER (NVL (REGEXP_REPLACE (carrier_mc, '[^0-9]+', ''), 0)),
TO_NUMBER (NVL (REGEXP_REPLACE (freight_forwarder_mc, '[^0-9]+', ''), 0)),
TO_NUMBER (NVL (REGEXP_REPLACE (carrier_mc, '[^0-9]+', ''), 0)),
TO_NUMBER (NVL (REGEXP_REPLACE (freight_forwarder_mc, '[^0-9]+', ''), 0)),
has been converted for Postgres as:
(coalesce(REGEXP_REPLACE(broker_mc, '[^0-9]+', '', 'g'), 0))::numeric ,
(coalesce(REGEXP_REPLACE(carrier_mc, '[^0-9]+', '', 'g'), 0))::numeric ,
(coalesce(REGEXP_REPLACE(freight_forwarder_mc, '[^0-9]+', '', 'g'), 0))::numeric ,
(coalesce(REGEXP_REPLACE(carrier_mc, '[^0-9]+', '', 'g'), 0))::numeric ,
(coalesce(REGEXP_REPLACE(freight_forwarder_mc, '[^0-9]+', '', 'g'), 0))::numeric ,
which is throwing the following error:
ERROR: COALESCE types text and integer cannot be matched
LINE 43: ...ce(REGEXP_REPLACE(broker_mc, '[^0-9]+', '', 'g'), 0))::numer...
^
--
LINE 43: ...ce(REGEXP_REPLACE(broker_mc, '[^0-9]+', '', 'g'), 0))::numer...
^
I have been looking through:
but I'm not seeing a way to resolve it. Would anyone be able to advise how to correct this for Postgres, please?
Thanks,
Sam
В списке pgsql-sql по дате отправления: