How To Declare Variable In PostgreSQL 9

IT Support Forum Forums Databases PostgreSQL SQL Queries How To Declare Variable In PostgreSQL 9


This topic contains 0 replies, has 1 voice, and was last updated by  Webmaster 2 years, 10 months ago.

  • Author
  • #1930


    Declaring variables in PostgreSQL 9 is not as simple as with MSSQL. To declare a variable in PostgreSQL 9, you must use the following syntax:

    DO $$
    DECLARE variableName TEXT := ‘value of variable’;
    END $$;

    You can assign variables in PosgreSQL by simply typing the variables name, followed by := ???, where ??? is the value of the variable you want to set.

You must be logged in to reply to this topic.