DESCRIBE PROCEDURE

저장 프로시저의 서명(즉, 인자), 반환 값, 언어, 본문(즉, 정의)을 포함하여, 지정된 저장 프로시저를 설명합니다.

참고 항목:

DROP PROCEDURE , ALTER PROCEDURE , CREATE PROCEDURE , SHOW PROCEDURES, SHOW USER PROCEDURES

구문

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

사용법 노트

  • 저장 프로시저를 설명하려면 저장 프로시저의 이름과 인자 데이터 타입(있는 경우)을 지정해야 합니다. 저장 프로시저는 이름 오버로딩을 지원하므로 인자가 필요합니다(즉, 같은 스키마에 있는 두 저장 프로시저의 이름이 해당 인자 데이터 타입이 다른 한 같을 수 있음).

  • 출력의 body 속성은 저장 프로시저에 대한 코드를 표시합니다.

  • 이 명령의 출력을 후처리하기 위해 파이프 연산자 (->>) 또는 RESULT_SCAN 함수를 사용할 수 있습니다. 두 구문 모두 출력을 쿼리할 수 있는 결과 세트로 간주합니다.

    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, specify SELECT "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;  |
|               |                      |
+---------------+----------------------+
Copy

다음은 매개 변수가 있는 저장 프로시저를 설명하는 방법을 보여주는 예입니다.

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