Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1t1BeY-00F5qb-SF for pgsql-sql@arkaria.postgresql.org; Wed, 16 Oct 2024 21:33:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1t1BeX-00AZrY-0q for pgsql-sql@arkaria.postgresql.org; Wed, 16 Oct 2024 21:33:57 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1t1BeW-00AZhJ-ND for pgsql-sql@lists.postgresql.org; Wed, 16 Oct 2024 21:33:57 +0000 Received: from mx0a-0039f802.pphosted.com ([205.220.164.45]) by makus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1t1BeR-001FWL-Tz for pgsql-sql@lists.postgresql.org; Wed, 16 Oct 2024 21:33:53 +0000 Received: from pps.filterd (m0209981.ppops.net [127.0.0.1]) by mx0b-0039f802.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49GGvFPe011107 for ; Wed, 16 Oct 2024 14:33:50 -0700 Received: from mail-yw1-f197.google.com (mail-yw1-f197.google.com [209.85.128.197]) by mx0b-0039f802.pphosted.com (PPS) with ESMTPS id 42a3hds3dg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Wed, 16 Oct 2024 14:33:50 -0700 (PDT) Received: by mail-yw1-f197.google.com with SMTP id 00721157ae682-6e3c638cc27so8442387b3.0 for ; Wed, 16 Oct 2024 14:33:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729114429; x=1729719229; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=KzWPTKGqJs33WXNSHeVC5SpT8oHHrR9n3hVy6CnSUTw=; b=OzDS1aXeJyh2S/8zOjkRSOq1rJH+vfBfX60a9DYvhrJpuBStPNABauwOfcx3V++amp dsQfDk0tyPb3VK/hvuCGQEU7nd1KJuxYxuowgdvk3V4www6S6BRpCSQPQ6fx+y05p764 CpqE1v5PT0ZmW2ESpmY48GS1Y4L3JyotrrxJhpNmaad8ZXzgMHtY3b+Xd9jn27J4Ath1 VimRWKkaXVIhosA8YDLby7PtjconJ4tNYRgKJLYLs2KbR8nT72G8XATQmyJhRdkuQyyA 0JTivG4NTnwJ43JWavvarcimtv5Rtoq5tWy6MdijrWjxEi7DRdxs7aLT+iuSSEs9v6iE oF0A== X-Gm-Message-State: AOJu0YxD2c0w7H35+YFTIDM468EbAhFjW9Q5vG5bnee4NJJSp43YuK9d YtKatsG/e3zzoZEqn92jHFIvYF16svGfdamaNARHgu00TCV9f83LL56sMKz23I4918jXVlvn9GY W35Y4VpWjye5MoupfphJa2hbDHGlC7nYUlOklVMoE23HQNQIZ4xMkQ2u1L4MiP4/coKoJtV4WjJ 2DJe9dN6CiWTyHP6kScwjbHx3MEeUjY7rWVi/yqmstemlPFHgNNp+F+01oNT/i3MU43erK6Yod8 bg= X-Received: by 2002:a05:690c:6713:b0:6e3:31ee:23ab with SMTP id 00721157ae682-6e3d4134717mr59432377b3.25.1729114429005; Wed, 16 Oct 2024 14:33:49 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHraq9NY/czoP60x4gtu+LqoZI2H26e7UYcPHqRRwt41ZTPj8ccRXuE2FsFf8EqV8HcTwVOSOYZL5lqRMICOio= X-Received: by 2002:a05:690c:6713:b0:6e3:31ee:23ab with SMTP id 00721157ae682-6e3d4134717mr59432087b3.25.1729114428270; Wed, 16 Oct 2024 14:33:48 -0700 (PDT) MIME-Version: 1.0 From: Sam Stearns Date: Wed, 16 Oct 2024 14:33:37 -0700 Message-ID: Subject: Postgres View DDL To: pgsql-sql Content-Type: multipart/alternative; boundary="00000000000046041006249ed345" X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-10-16_17,2024-10-16_01,2024-09-30_01 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --00000000000046041006249ed345 Content-Type: text/plain; charset="UTF-8" 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)), 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 , 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... ^ I have been looking through: https://www.postgresql.org/docs/current/functions-conditional.html#FUNCTIONS-COALESCE-NVL-IFNULL https://www.postgresql.org/docs/current/typeconv-union-case.html 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 -- *Samuel Stearns* Lead Database Administrator *c:* 971 762 6879 | *o:* 503 672 5115 | DAT.com [image: DAT] --00000000000046041006249ed345 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Howdy,

I have an Oracle view that's= been converted for Postgres.=C2=A0 This block of code in the Oracle view D= DL:

TO_NUMBER (NVL (REGEXP_REPLACE (broker_mc, = 9;[^0-9]+', ''), 0)),
TO_NUMBER (NVL (REGEXP_REPLACE (carrie= r_mc, '[^0-9]+', ''), 0)),
TO_NUMBER (NVL (REGEXP_REPLAC= E (freight_forwarder_mc, '[^0-9]+', ''), 0)),
has been converted for Postgres as:

(c= oalesce(REGEXP_REPLACE(broker_mc, '[^0-9]+', '', 'g'= ;), 0))::numeric ,
(coalesce(REGEXP_REPLACE(carrier_mc, '[^0-9]+'= ;, '', 'g'), 0))::numeric ,
(coalesce(REGEXP_REPLACE(fre= ight_forwarder_mc, '[^0-9]+', '', 'g'), 0))::numeri= c ,

which is throwing the following error:

ERROR: =C2=A0COALESCE types text and integer cannot be ma= tched
LINE 43: ...ce(REGEXP_REPLACE(broker_mc, '[^0-9]+', '&= #39;, 'g'), 0))::numer...
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0^
I have been looking through:


but I'm not seeing a way to re= solve it.=C2=A0 Would anyone be able to advise how to correct this for Post= gres, please?

Thanks,

Sam=

--
<= div dir=3D"ltr" class=3D"gmail_signature" data-smartmail=3D"gmail_signature= ">

Samuel Stear= ns
Lead Database Adminis= trator
c:=C2=A0971 762 6879=C2=A0|=C2=A0o:=C2=A0503 672 5115=C2=A0<= span style=3D"color:rgb(147,149,152)">|
=C2=A0DAT.com

--00000000000046041006249ed345--