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.For example, you can use the pipe operator or RESULT_SCAN function to select specific columns from the SHOW command output or filter the rows.
When you refer to the output columns, use double-quoted identifiers for the column names. For example, to select the output column
type, specifySELECT "type".You must use double-quoted identifiers because the output column names for SHOW commands are in lowercase. The double quotes ensure that the column names in the SELECT list or WHERE clause match the column names in the SHOW command output that was scanned.
示例¶
此示例说明如何描述没有参数的存储过程:
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; | | | | +---------------+------------------------------------------------------------------+