как вызвать процедуру оракула и функцию внутри другой процедуры - PullRequest
0 голосов
/ 24 сентября 2019

У меня есть ситуация, когда мне нужно сделать следующее.

Step1: вызвать процедуру с заданными входными значениями и получить 2 выходных значения.

step2: вызвать функциюс входными параметрами вместе с одним из выходных значений из Step1 (вызов процедуры)

Step3: Извлечение выходного значения из возвращаемого значения Step2.

Пожалуйста, помогите, как справиться с этой ситуацией.

Спасибо

1 Ответ

1 голос
/ 24 сентября 2019

Очень простой пример с составленными именами переменных, типами данных (все цифры для простоты), а также именами и сигнатурами процедур / функций:

create or replace procedure wrapper_proc as
  -- define local variables; use appropriate data types!
  l_input_1 number;
  l_input_2 number;
  l_output_1 number;
  l_output_2 number;
  l_result number;
begin
  -- Step1: Call a procedure with the given input values and get the 2 output values.
  l_input_1 := 42;
  l_input_2 := 128;
  your_proc (l_input_1, l_input_2, l_output_1, l_output_2);
  -- l_output_1 and l_output_2 are not set by that first procedire

  -- step2: Call the function with input parameters along with one of the output value from Step1(procedure call)
  -- assuming same two original inuts, and one of the procedure outputs...
  l_result := your_func (l_input_1, l_input_2, l_output_2);

  --Step3: Extract the output value from the return value of Step2.
  -- do something unspecified with l_result
  dbms_output.put_line('Final result was: ' || l_result);
end;
/

Или если вы хотите передать входные значения в этопроцедура упаковки:

create or replace procedure wrapper_proc (
  -- arguments; use appropriate data types!
  p_input_1 number,
  p_input_2 number
) as
  -- define local variables; use appropriate data types!
  l_output_1 number;
  l_output_2 number;
  l_result number;
begin
  -- Step1: Call a procedure with the given input values and get the 2 output values.
  your_proc (p_input_1, p_input_2, l_output_1, l_output_2);
  -- l_output_1 and l_output_2 are not set by that first procedire

  -- step2: Call the function with input parameters along with one of the output value from Step1(procedure call)
  -- assuming same two original inuts, and one of the procedure outputs...
  l_result := your_func (p_input_1, p_input_2, l_output_2);

  --Step3: Extract the output value from the return value of Step2.
  -- do something unspecified with l_result
  dbms_output.put_line('Final result was: ' || l_result);
end;
/
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...