Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n54Yr-0006DZ-AM for pgsql-general@arkaria.postgresql.org; Wed, 05 Jan 2022 11:34:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1n54Yp-0001LU-DC for pgsql-general@arkaria.postgresql.org; Wed, 05 Jan 2022 11:34:31 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n54Yp-0001LL-2X for pgsql-general@lists.postgresql.org; Wed, 05 Jan 2022 11:34:31 +0000 Received: from lana.depesz.com ([88.198.49.178] helo=depesz.com) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n54Ym-0008DX-Tr for pgsql-general@lists.postgresql.org; Wed, 05 Jan 2022 11:34:30 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=depesz.com; s=20170201; h=In-Reply-To:Content-Type:MIME-Version:References:Reply-To: Message-ID:Subject:Cc:To:Sender:From:Date:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=a1BmbdqWznajO53qdb7gBywlfuwmqE8dobG/+XRiq1A=; b=ZlHLJY6L0JeM2ks2Q/NzodPDt6 JxlZscXEokzd5YYDqlPFFkExp4agTwuUwIxXVeYQDpcqP/qmwuW19L3DxAV2XJbDqfOkBaczpkRi0 6owC+4k3AnbxINOVwrTTHU7rux6kmsAryKnc7hK/YvrroHEx3YPop8CoFKA/QBf+K8dI=; Received: from lana.depesz.com ([88.198.49.178] helo=depesz.com) by depesz.com with esmtpa (Exim 4.92) (envelope-from ) id 1n54Yk-0004BV-O9; Wed, 05 Jan 2022 12:34:26 +0100 Date: Wed, 5 Jan 2022 12:34:26 +0100 From: hubert depesz lubaczewski Sender: depesz@depesz.com To: Shaozhong SHI Cc: pgsql-general Subject: Re: Can we use sql language to create a function in Postgres? Message-ID: <20220105113426.GA14488@depesz.com> Reply-To: depesz@depesz.com References: <20220105111258.GA18163@depesz.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, Jan 05, 2022 at 11:22:34AM +0000, Shaozhong SHI wrote: > If so, can we use Oracle SQL script in DO block? > > Does this mean that all Oracle SQL can be used in Postgres? I highly doubt that. But - I used oracle last time like 2 years ago, so the only thing I can tell you: TRY. instead of asking if "something vague wll work" just try. it will work, or not work, but I can't guess what you have in this "oracle sql" and whether this particular bit of sql will be cross-plaftorm enough to execute (or even parse) in pg. depesz