SHOW CREATE PROCEDURE
Function
Returns the exact string that can be used to recreate the named stored procedure. A similar statement SHOW CREATE FUNCTION displays information about storage functions. To use either statement, you must have the global SELECT permission.
Precautions
The sql_mode indicates the session value during query. Database b displays the sql_mode bound during routine creation. openGauss displays the session value because openGauss does not bind routines to sql_mode during routine creation.
character_set_client is the session value of the system variable when client_encoding creates the routine.
collation_connection is the value specified when lc_collate creates the database.
Database Collation is the value specified when lc_collate creates the database.
Syntax
SHOW CREATE PROCEDURE proc_name
Parameter Description
proc_name
Name of the stored procedure.
Examples
--Create a stored procedure.
openGauss=# create procedure test_procedure_test(int,int)
openGauss-# SHIPPABLE IMMUTABLE
openGauss-# as
openGauss$# begin
openGauss$# select $1 + $2;
openGauss$# end;
openGauss$# /
CREATE PROCEDURE
--Query the statement for creating a stored procedure.
openGauss=# show create procedure test_procedure_test;
Procedure | Create Procedure | sql_mode | character_set_client | collation_connection | Database Collation
---------------------+-----------------------------------------------------------------+-------------------------------------+----------------------+----------------------+--------------------
test_procedure_test | CREATE OR REPLACE PROCEDURE public.test_procedure_test(int,int)+| sql_mode_strict,sql_mode_full_group | UTF8 | en_US.UTF-8
| en_US.UTF-8
| IMMUTABLE SHIPPABLE +| | |
|
| AS DECLARE +| | |
|
| begin +| | |
|
| select $1 + $2; +| | |
|
| end; +| | |
|
| / +| | |
|
| | | |
|
(1 row)