Only 3.9% of viewers are subscribing to my channel 😓.
I request you to please give click on Subscribe button.
It really helps me grow 😢.
How To Create A Stored Procedure And Insert Data Into A Table By Calling/Using The Stored Procedure
-- the purpose is to create a simple stored procedure in PostgreSQL
-- and Insert Data in the table by calling it using pgAdmin
CREATE TABLE public.testing_table (dummy_column text);
CREATE OR REPLACE PROCEDURE public.testing_procedure(p_msg text)
LANGUAGE 'plpgsql'
AS $BODY$
DECLARE
BEGIN
INSERT INTO public.testing_table(dummy_column) VALUES('Before Inserting Parameter Value');
INSERT INTO public.testing_table(dummy_column) VALUES (p_msg);
INSERT INTO public.testing_table(dummy_column) VALUES('After Inserting Parameter Value');
END;
$BODY$;
SELECT * FROM public.testing_table;
DELETE from public.testing_table;
CALL public.testing_procedure('Hello Akram, How are you?');
Before Inserting
the message I pass as a parameter
After Inserting...
No comments:
Post a Comment