DESCRIBE PROCEDURE

Describes the specified stored procedure, including the stored procedure’s signature (i.e. arguments), return value, language, and body (i.e. definition).

See also:

DROP PROCEDURE , ALTER PROCEDURE , CREATE PROCEDURE , SHOW PROCEDURES

Syntax

DESC[RIBE] PROCEDURE <procedure_name> ( [ <arg_data_type> [ , <arg_data_type_2> ... ] ] )
Copy

Usage notes

  • To describe a stored procedure, you must specify the name and the argument data type(s), if any, for the stored procedure. The arguments are required because stored procedures support name overloading (i.e. two stored procedures in the same schema can have the same name as long as their argument data types are different).

  • The body property in the output displays the code for the stored procedure.

Examples

This example shows how to describe a stored procedure that has no parameters:

DESC PROCEDURE my_pi();
+---------------+----------------------+
| property      | value                |
|---------------+----------------------|
| signature     | ()                   |
| returns       | FLOAT                |
| language      | JAVASCRIPT           |
| null handling | CALLED ON NULL INPUT |
| volatility    | VOLATILE             |
| execute as    | CALLER               |
| body          |                      |
|               |   return 3.1415926;  |
|               |                      |
+---------------+----------------------+
Copy

This example shows how to describe a stored procedure that has a parameter:

DESC PROCEDURE area_of_circle(FLOAT);
+---------------+------------------------------------------------------------------+
| property      | value                                                            |
|---------------+------------------------------------------------------------------|
| signature     | (RADIUS FLOAT)                                                   |
| returns       | FLOAT                                                            |
| language      | JAVASCRIPT                                                       |
| null handling | CALLED ON NULL INPUT                                             |
| volatility    | VOLATILE                                                         |
| execute as    | OWNER                                                            |
| body          |                                                                  |
|               |   var stmt = snowflake.createStatement(                          |
|               |       {sqlText: "SELECT pi() * POW($RADIUS, 2)", binds:[RADIUS]} |
|               |       );                                                         |
|               |   var rs = stmt.execute();                                       |
|               |   rs.next()                                                      |
|               |   var output = rs.getColumnValue(1);                             |
|               |   return output;                                                 |
|               |                                                                  |
+---------------+------------------------------------------------------------------+
Copy
Language: English