aws redshift - how to retrieve out parameters of stored procedure

0

Please give a query to retrieve out parameters for a particular stored procedure by using a sql query in aws redshift . thank you.

질문됨 2년 전2240회 조회
2개 답변
0

Please look at the answers to this question.

An example of query from one of the answer is:

SELECT p.proname sp_name , n.nspname sp_schema , p.proargnames sp_args 
FROM pg_catalog.pg_namespace n 
JOIN pg_catalog.pg_proc p ON p.pronamespace = n.oid 
WHERE p.proowner > 1 AND p.prolang = 100125 ;
AWS
전문가
답변함 2년 전
0

Here is an example from our documentation:

CREATE OR REPLACE PROCEDURE inner_proc(INOUT a int, b int, INOUT c int) LANGUAGE plpgsql
AS $$
BEGIN
  a := b * a;
  c := b * c;
END;
$$;

CREATE OR REPLACE PROCEDURE outer_proc(multiplier int) LANGUAGE plpgsql
AS $$
DECLARE
  x int := 3;
  y int := 4;
BEGIN
  DROP TABLE IF EXISTS test_tbl;
  CREATE TEMP TABLE test_tbl(a int, b varchar(256));
  CALL inner_proc(x, multiplier, y);
  insert into test_tbl values (x, y::varchar);
END;
$$;

CALL outer_proc(5);
      
SELECT * from test_tbl;
 a  | b
----+----
 15 | 20
(1 row)  

The inner_proc has an INOUT parameter and you can see that the outer_proc called it with "y". This variable started out as 4 but was modified with inner_proc to now be 20. https://docs.aws.amazon.com/redshift/latest/dg/r_CALL_procedure.html

profile pictureAWS
전문가
답변함 2년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠