DESCRIBE PROCEDURE¶
描述指定的存储过程,包括存储过程的签名(如实参)、返回值、语言和正文(如定义)。
语法¶
DESC[RIBE] PROCEDURE <procedure_name> ( [ <arg_data_type> [ , <arg_data_type_2> ... ] ] )
使用说明¶
要描述存储过程,必须为存储过程指定名称和实参数据类型(如果有)。这些实参是必需的,因为存储过程支持名称重载(即同一架构中的两个存储过程只要实参数据类型不同,就可以具有相同的名称)。
输出中的
body
属性显示存储过程的代码。
示例¶
此示例说明如何描述没有参数的存储过程:
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; | | | | +---------------+----------------------+
此示例说明如何描述具有参数的存储过程:
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; | | | | +---------------+------------------------------------------------------------------+