0

In plsql, we can create function/procedure within an anonymous block and reuse it.

example:

declare
   procedure TEST_DATE
   as
   begin
     dbms_output.put_line (sysdate);
   end;
begin
   TEST_DATE;
end;

could we do similar in pgplsql ?

snowrock
  • 161
  • 1
  • 1
  • 8
  • 1
    No, that's not possible. –  Nov 20 '17 at 22:16
  • Is there any way to re-use anonymous block or should i create a function and later drop it? – snowrock Nov 20 '17 at 22:20
  • 2
    You can create a temporary function: https://stackoverflow.com/q/4990622/330315 –  Nov 20 '17 at 22:20
  • if you want just `dbms_output.put_line`, you can create function in transaction, reuse it as many times as you need and rollback - it will "drop" function – Vao Tsun Nov 21 '17 at 09:12

0 Answers0