DESCRIBE PROCEDURE¶
描述指定的存储过程,包括存储过程的签名(如实参)、返回值、语言和正文(如定义)。
语法¶
DESC[RIBE] PROCEDURE <procedure_name> ( [ <arg_data_type> [ , <arg_data_type_2> ... ] ] )
使用说明¶
要描述存储过程,必须为存储过程指定名称和实参数据类型(如果有)。这些实参是必需的,因为存储过程支持名称重载(即同一架构中的两个存储过程只要实参数据类型不同,就可以具有相同的名称)。
输出中的
body属性显示存储过程的代码。
To post-process the output of this command, you can use the pipe operator (
->>) or the RESULT_SCAN function. Both constructs treat the output as a result set that you can query.The output column names for this command are generated in lowercase. If you consume a result set from this command with the pipe operator or the RESULT_SCAN function, use double-quoted identifiers for the column names in the query to ensure that they match the column names in the output that was scanned. For example, if the name of an output column is
type, then specify"type"for the identifier.
示例¶
此示例说明如何描述没有参数的存储过程:
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; | | | | +---------------+------------------------------------------------------------------+