May 2020
Beginner
564 pages
14h 9m
English
In PostgreSQL, you can't return data via a stored procedure. If you need to return data, you will need to use a function instead. If you want to create a stored procedure to insert, update, or delete data, you can use the following syntax:
CREATE OR REPLACE PROCEDURE procedurename()LANGUAGE plpgsql AS $$BEGIN -- update, insert, or delete sql statements go here END $$;
To create a stored procedure with IN parameters, you can use the following syntax:
CREATE OR REPLACE PROCEDURE procedurename( varname vartype, varname2 vartype)LANGUAGE plpgsql AS $$BEGIN INSERT INTO tablename (col1, col2) VALUES (varname, varname2); END $$;
Since no results can be returned from a PostgreSQL stored procedure, there ...
Read now
Unlock full access