begin
declare @msgid varchar(128);
loop
set @msgid = ml_qa_getmessagetimeout( 'myaddress', 10000 );
if @msgid is null then
message 'waiting for a message...';
else
message 'a message with content ' || ml_qa_gettextcontent( @msgid ) || ' has been received';
commit;
end if;
end loop;
end