Search Postgresql Archives

Nested-Internal Functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello ,

I have a query about creating nested functions in PostgreSQL.

I am currently using PostgreSQL 15 and I am trying to create a nested function with the following structure:

CREATE OR REPLACE FUNCTION external_function ()

RETURNS void AS $$

DECLARE

external_variable;

   

    -- Define the internal function

    FUNCTION internal_function ()

    RETURNS void AS $$

    DECLARE

        internal_variable INT;

    BEGIN

        -- Internal function code

        internal_variable:= 10;

        RAISE NOTICE 'Internal Variable: %', internal_variable;

    END;

    $$ LANGUAGE plpgsql;

BEGIN

    -- External function code

    external_variable:= 5;

    RAISE NOTICE 'External variable: %', external_variable;

 

    -- Call internal function

    PERFORM internal_function ();

END;

$$ LANGUAGE plpgsql;

 

However, I get an error, and I can't compile the function.

Thank you very much for your help

Rossana Ocampos


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux