Search notes:

DBMS_PIPE: most simple example (send and receive)

The following two scripts blue.sql and green.sql need to be executed in two separate sessions.

blue.sql

declare

   v number;

begin

-- Wait 3 seconds...
   dbms_lock.sleep(3);

-- ... then write a message into a pipe

   dbms_pipe.pack_message('Hello from the blue session!');

   v := dbms_pipe.send_message('tq84-send-receive-pipe');

   dbms_output.put_line('Message sent [' || v || ']');

end;
/

exit
Github repository Oracle-Patterns, path: /Installed/dbms/pipe/send_receive/blue.sql

green.sql

declare

   v number;

   m varchar2(4096);
 
begin

-- Waiting for the message sent in the green session:
   
   v := dbms_pipe.receive_message('tq84-send-receive-pipe');

   dbms_pipe.unpack_message(m);

   dbms_output.put_line('Message received [' || v || ']');
   dbms_output.put_line('  ' || m);


end;
/

exit
Github repository Oracle-Patterns, path: /Installed/dbms/pipe/send_receive/green.sql

session_blue.bat

@color 1f

@sqlplus -S %connect_string% @blue
Github repository Oracle-Patterns, path: /Installed/dbms/pipe/send_receive/session_blue.bat

session_green.bat

@color 2f

@sqlplus -S %connect_string% @green
Github repository Oracle-Patterns, path: /Installed/dbms/pipe/send_receive/session_green.bat

run.bat

@set connect_string=rene/rene

@start session_blue.bat
@start session_green.bat
Github repository Oracle-Patterns, path: /Installed/dbms/pipe/send_receive/run.bat

See also

dbms_pipe

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1759562066, '216.73.216.149', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/databases/Oracle/installed/packages/dbms/pipe/send-receive(121): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78