JMS_TEXT_MESSAGE isn't available as a type in Oracle XE databases. This code back ports it.
These are replacement objects for JMS_TEXT_MESSAGE which isn't availiable in Oracle XE
This can be used in a create queue table statement:
-
dbms_aqadm.create_queue_table(
-
queue_table => 'webserv.TEST',
-
multiple_consumers => false,
-
queue_payload_type => 'sys.RJM_JMS_TEXT_MESSAGE'
-
);
-
<plsql>
-
Run as SYS
-
<plsql>
-
create or replace
-
TYPE RJM_JMS_TEXT_STR_PROP_v AS VARRAY(50) OF VARCHAR2(255);
-
create or replace
-
type RJM_JMS_TEXT_MESSAGE AS OBJECT
-
(
-
m_payload CLOB,
-
-- m_str_prop_names RJM_JMS_TEXT_STR_PROP_v,
-
-- m_str_prop_values RJM_JMS_TEXT_STR_PROP_v,
-
m_properties XMLTYPE,
-
m_str_props_siz number,
-
CONSTRUCTOR FUNCTION RJM_JMS_TEXT_MESSAGE RETURN SELF AS RESULT,
-
STATIC FUNCTION construct RETURN rjm_jms_text_message,
-
MEMBER PROCEDURE set_text ( payload IN VARCHAR2 ),
-
MEMBER PROCEDURE set_text ( payload IN CLOB ),
-
MEMBER PROCEDURE get_text ( payload OUT VARCHAR2 ),
-
MEMBER PROCEDURE get_text ( payload OUT CLOB ),
-
MEMBER PROCEDURE set_string_property (
-
property_name IN VARCHAR,
-
property_value IN VARCHAR ),
-
MEMBER FUNCTION get_string_property ( property_name IN VARCHAR)
-
RETURN VARCHAR
-
-
/*
-
Type created to emulate AQ$_JMS_TEXT_MESSAGE on XE Database
-
Non-implemented functions below
-
-
header aq$_jms_header,
-
text_len int,
-
text_vc varchar2(4000),
-
text_lob clob,
-
MEMBER PROCEDURE set_replyto (replyto IN sys.aq$_agent),
-
MEMBER PROCEDURE set_type (type IN VARCHAR ),
-
MEMBER PROCEDURE set_userid (userid IN VARCHAR ),
-
MEMBER PROCEDURE set_appid (appid IN VARCHAR ),
-
MEMBER PROCEDURE set_groupid (groupid IN VARCHAR ),
-
MEMBER PROCEDURE set_groupseq (groupseq IN int ),
-
MEMBER PROCEDURE clear_properties ,
-
MEMBER PROCEDURE set_boolean_property (
-
property_name IN VARCHAR,
-
property_value IN BOOLEAN ),
-
MEMBER PROCEDURE set_byte_property (
-
property_name IN VARCHAR,
-
property_value IN int ),
-
MEMBER PROCEDURE set_short_property (
-
property_name IN VARCHAR,
-
property_value IN int ),
-
MEMBER PROCEDURE set_int_property (
-
property_name IN VARCHAR,
-
property_value IN int ),
-
MEMBER PROCEDURE set_long_property (
-
property_name IN VARCHAR,
-
property_value IN NUMBER ),
-
MEMBER PROCEDURE set_float_property (
-
property_name IN VARCHAR,
-
property_value IN FLOAT ),
-
MEMBER PROCEDURE set_double_property (
-
property_name IN VARCHAR,
-
property_value IN DOUBLE PRECISION ),
-
MEMBER FUNCTION get_replyto RETURN sys.aq$_agent,
-
MEMBER FUNCTION get_type RETURN VARCHAR,
-
MEMBER FUNCTION get_userid RETURN VARCHAR,
-
MEMBER FUNCTION get_appid RETURN VARCHAR,
-
MEMBER FUNCTION get_groupid RETURN VARCHAR,
-
MEMBER FUNCTION get_groupseq RETURN int,
-
MEMBER FUNCTION get_boolean_property ( property_name IN VARCHAR)
-
RETURN BOOLEAN,
-
MEMBER FUNCTION get_byte_property ( property_name IN VARCHAR)
-
RETURN int,
-
MEMBER FUNCTION get_short_property ( property_name IN VARCHAR)
-
RETURN int,
-
MEMBER FUNCTION get_int_property ( property_name IN VARCHAR)
-
RETURN int,
-
MEMBER FUNCTION get_long_property ( property_name IN VARCHAR)
-
RETURN NUMBER,
-
MEMBER FUNCTION get_float_property ( property_name IN VARCHAR)
-
RETURN FLOAT,
-
MEMBER FUNCTION get_double_property ( property_name IN VARCHAR)
-
RETURN DOUBLE PRECISION,
-
*/
-
)
-
create or replace
-
type body RJM_JMS_TEXT_MESSAGE AS
-
-
CONSTRUCTOR FUNCTION RJM_JMS_TEXT_MESSAGE RETURN SELF AS RESULT
-
AS
-
BEGIN
-
self.m_str_props_siz := 0;
-
self.m_properties := XMLTYPE('<a></a>');
-
return;
-
END;
-
STATIC FUNCTION construct RETURN RJM_JMS_TEXT_MESSAGE
-
IS
-
BEGIN
-
return NEW RJM_JMS_TEXT_MESSAGE;
-
END;
-
-
-
MEMBER PROCEDURE set_text ( payload IN VARCHAR2 )
-
IS
-
BEGIN
-
self.m_payload := to_clob(payload);
-
END;
-
-
MEMBER PROCEDURE set_text ( payload IN CLOB )
-
IS
-
BEGIN
-
self.m_payload := payload;
-
END;
-
-
MEMBER PROCEDURE get_text ( payload OUT VARCHAR2 )
-
IS
-
BEGIN
-
payload := dbms_lob.substr(self.m_payload,4000,1);
-
END;
-
-
MEMBER PROCEDURE get_text ( payload OUT CLOB )
-
IS
-
BEGIN
-
payload := self.m_payload;
-
END;
-
-
MEMBER PROCEDURE set_string_property (
-
property_name IN VARCHAR,
-
property_value IN VARCHAR )
-
IS
-
l_newXML CLOB := '';
-
l_name varchar2(2048);
-
l_value varchar2(2048);
-
l_result_cnt number;
-
l_tochange boolean := true;
-
BEGIN
-
-
l_newXML := '<a>';
-
l_result_cnt := 1;
-
WHILE self.m_properties.EXISTSNODE('/a/p[' || l_result_cnt || ']') = 1
-
LOOP
-
SELECT
-
EXTRACTVALUE(self.m_properties, '/a/p[' || l_result_cnt || ']/n'),
-
EXTRACTVALUE(self.m_properties, '/a/p[' || l_result_cnt || ']/v')
-
INTO
-
l_name,
-
l_value
-
FROM dual;
-
-
if l_name=property_name then
-
l_value := property_value;
-
l_tochange := false;
-
end if;
-
-
dbms_lob.append(l_newXML,'<p><n>' || l_name || '</n><v>' || l_value || '</v></p>');
-
-
l_result_cnt := l_result_cnt + 1;
-
END LOOP;
-
if l_tochange then
-
dbms_lob.append(l_newXML,'<p><n>' || property_name || '</n><v>' || property_value || '</v></p>');
-
end if;
-
dbms_lob.append(l_newXML,'</a>');
-
-
self.m_properties := XMLTYPE(l_newXML);
-
END;
-
-
MEMBER FUNCTION get_string_property ( property_name IN VARCHAR)
-
RETURN VARCHAR
-
IS
-
l_value varchar2(2048);
-
BEGIN
-
SELECT
-
EXTRACTVALUE(self.m_properties, '/a/p[./n="' || property_name || '"]/v')
-
INTO
-
l_value
-
FROM dual;
-
return l_value;
-
END;
-
-
-
end;
RJM Article Type
Quick Reference