Stored procedures in postgresql

hello I want to know WHERE to write stored procedures in postgreSQL ?? I do not mean how to write, but the most basic thing, where to write ... where to go if I want to write one? Is it written as a request or in some other file? I'm pretty new to postgresql so please xplain as much as possible

Thanks u

+3
source share
2 answers

Just use any text editor to create a (SQL) file containing the required CREATE FUNCTION statement.

Then run this file using psql.

GUI, pgAdmin - (Squirrel, DbVisualizer, SQL Workbench/J,...), "", , .

+4

CREATE FUNCTION... PSQL.

- (psuedo SQL):

CREATE OR REPLACE FUNCTION
    MyProc(text, text)
RETURNS
    void
AS
    $delimiter$
    INSERT INTO MyTable (text_val_1, text_val_2)
    VALUES ($1, $2);
    $delimiter$
LANGUAGE SQL;

:

http://www.day32.com/MySQL/Meetup/Presentations/postgresql_stored_procedures.pdf

+2

Source: https://habr.com/ru/post/1777118/


All Articles