This expression as written is not valid PL/SQL. Here’s why and how to fix it.
CHR(99)||CHR(99)||CHR(99) = 'ccc'. But
- DBMS_PIPE.RECEIVE_MESSAGE is a procedure with an OUT parameter, not a function that returns a value.
- The first parameter to RECEIVE_MESSAGE must be a variable (to receive the message), not a constant like 'ccc'.
The 555* prefix implies multiplication, which doesn’t apply to a procedure call. You can’t multiply the result of RECEIVE_MESSAGE directly.
The second parameter (58.446) is the timeout in seconds and is okay as a numeric literal, but you still must pass a variable for the OUT parameter.
Correct usage (example 1: just receive and print):
DECLARE v_msg VARCHAR2(32767); BEGIN DBMS_PIPE.RECEIVE_MESSAGE(v_msg, 58.446); DBMS_OUTPUT.PUT_LINE('Received: ' || v_msg); END; /
If you expect the received message to be numeric and want to multiply by 555:
DECLARE v_msg VARCHAR2(32767); v_num NUMBER; BEGIN DBMS_PIPE.RECEIVE_MESSAGE(v_msg, 58.446); v_num := 555 * TO_NUMBER(v_msg); -- assumes v_msg is numeric DBMS_OUTPUT.PUT_LINE(TO_CHAR(v_num)); EXCEPTION WHEN VALUE_ERROR THEN DBMS_OUTPUT.PUT_LINE('Message is not numeric'); END; /
Or, to test sending a known message:
BEGIN DBMS_PIPE.SEND_MESSAGE('ccc'); END; /
Key takeaways:
- RECEIVE_MESSAGE uses an OUT parameter; you must use a variable.
- The first argument cannot be a literal expression like 'ccc'.
- The 555* part is not valid unless you first store the received data in a variable and then perform arithmetic on it.