1

I have PL/SQL query:

declare
  l_result integer;
begin
  l_res := [Calling another procedure]
  dbms_output.put_line('res = '||l_res);
end;

When i am trying to execute it in JMeter as JDBC Request (query type: Callable Statement) it returns "Response code is 200 & OK" but nothing in response data because i am outputting to dbms. So how can i return the l_res as "Response Data" so i can check it in "View Results Test"?

return l_res is not working because "PLS-00372: In a procedure, RETURN statement cannot contain an expression".

The question for me is: How to return variable value as Response Data from anonymous PLSQL block.

JMeter JDBC Request interface (image)

t3mpw
  • 11
  • 3
  • Why do you need a PL/SQL block - can't you call the function (not procedure, since you're already assigning its return value to a variable) directly, or in a query? – Alex Poole Dec 06 '18 at 12:52
  • I have a little bit more complex logic so i cant just call function in this block. I am new with plsql/jmeter so i dont have many ways to think about it. That is why, just returning l_res value seems to me the most easy way. – t3mpw Dec 06 '18 at 12:58
  • Then can JMeter bind an output variable for the call to your anonymous block; so rather than having a local variable declared, have `:l_res := `? The colon before the name indicates it's a bind variable. Or maybe `? := `? (I don't use JMeter, no idea exactly how that would be bound...) – Alex Poole Dec 06 '18 at 13:03
  • I added :l_res in declare block, and "Result variable name: OUT". I think wrapping and storing this block with "CREATE OR REPLACE FUNCTION" not gonna help me, because i still be querying anonymous block to execute this function. The question for me is: how to return variable as Response Data from anynoumous PLSQL block. – t3mpw Dec 06 '18 at 13:17

0 Answers0