This snippet has a few problems and likely won’t work as written. Here’s what’s going on and how to fix it.
What the pieces mean
- CHR(99) is 'c', so CHR(99)||CHR(99)||CHR(99) = 'ccc'.
- DBMS_PIPE.RECEIVE_MESSAGE is used to receive a message from a named pipe. It generally takes an OUT buffer to receive the message and a timeout (in seconds).
- The 19.687 is the timeout in seconds.
- The leading 555* is not valid here. You can’t multiply a number by a procedure call in PL/SQL.
Common correct usages Note: the exact form depends on your Oracle version, but typically RECEIVE_MESSAGE is used with an OUTPUT variable (and sometimes returns a status).
Option A: RECEIVE_MESSAGE as a procedure ( OUT parameter, could return a status) DECLARE l_message VARCHAR2(32767); l_status NUMBER; -- if your version returns a status BEGIN -- If your version uses a return value: l_status := DBMS_PIPE.RECEIVE_MESSAGE(l_message, 19.687); -- Then check status and use l_message IF l_status = 0 THEN DBMS_OUTPUT.PUT_LINE('Received: ' || l_message); ELSE DBMS_OUTPUT.PUT_LINE('Timeout or error: ' || l_status); END IF;
-- Or, if it does not return a status (just fills l_message): -- DBMS_PIPE.RECEIVE_MESSAGE(l_message, 19.687); -- DBMS_OUTPUT.PUT_LINE('Received: ' || l_message); END;
Option B: If you only declare a buffer and call without a status return DECLARE l_message VARCHAR2(32767); BEGIN DBMS_PIPE.RECEIVE_MESSAGE(l_message, 19.687); IF l_message IS NOT NULL THEN DBMS_OUTPUT.PUT_LINE('Received: ' || l_message); ELSE DBMS_OUTPUT.PUT_LINE('No message within timeout'); END IF; END;
Notes
- You cannot pass a literal like 'ccc' as the OUT parameter. You must pass a variable that will receive the message.
- The 19.687 seconds is a timeout; the call will wait up to that long for a message on the pipe.
- The exact return semantics (whether RECEIVE_MESSAGE returns a value or just fills the OUT parameter) depend on your Oracle version. Use a variable to hold the OUT parameter, and optionally capture a return status if your version provides one.
If you tell me your Oracle version or the exact DBMS_PIPE usage you're studying (and whether you expect a return value or not), I can give a precise, version-specific snippet.
