On Wed, 2025-03-26 at 20:27 +, Dirschel, Steve wrote:
> DO $$
>
> BEGIN
>
> EXECUTE 'create or replace procedure junk.test_proc() ' ||
> 'LANGUAGE plpgsql ' ||
> 'AS $$ ' ||
> 'declare ' ||
> ' v_cnt
Hi,
I have the need to dynamically create a procedure. Here is a simple procedure:
create or replace procedure junk.test_proc()
LANGUAGE plpgsql
AS $$
declare
v_cnt integer := 0;
begin
raise notice 'v_cnt is %', v_cnt;
end $$;
That creates and runs fine.
Here I’m trying to create i
> On Mar 26, 2025, at 13:27, Dirschel, Steve
> wrote:
>
> I think the problem has to do with having AS $$ and END $$ with the 2 $’s.
PostgreSQL's multiline-string syntax is quite flexible. You can do things like:
DO $doblock$
...
$doblock$
LANGUAGE plpgsql;
I tend to put the name of th