Error in creating rss using pl/sql
845345Sep 9 2011 — edited Sep 9 2011Hi everyone
I am using below PLSQL to create an rss , this procedure getting compiled very well but when i try to execute it giving below errors
CREATE OR REPLACE PROCEDURE sp_rssfeed(
p1 IN NUMBER DEFAULT NULL
) AS
v_xml blob;
v_user VARCHAR2(100);
BEGIN
SELECT user
INTO v_user
FROM dual;
WITH a AS(
SELECT *
FROM (
SELECT owner, count(1) num_tabs
FROM all_tables
GROUP BY owner
order by count(1) desc
)
WHERE rownum <= 5
)
SELECT
XMLElement("rss",
XMLAttributes('2.0' as "version"),
XMLElement("channel",
XMLElement("title",
'Title: APEX test RSS Feed, User:= '||v_user),
XMLElement("link",
'http://www.oracle.com/global/de/community'),
XMLElement("description",
'Description: APEX test RSS Feed, p1:='||p1),
XMLElement("language", 'en-us'),
XMLElement("copywrite", 'Copyright '||
to_char(sysdate, 'YYYY')||' Rich Murnane'),
(
XMLAgg(
XMLElement("item",
XMLElement("pubDate",
to_char(sysdate - rownum,
'DAY, DD MON YYYY HH24:MI:SS')),
XMLElement(
"title",
'The DB user named: '||a.owner||' has '||
a.num_tabs||' table(s)'
),
XMLElement(
"link",
'http://richmurnane.blogspot.com'
)
)
)
)
)
).getblobval(nls_charset_id('AL32UTF8')) into v_xml
from a;
owa_util.mime_header('text/xml');
wpg_docload.download_file(v_xml);
dbms_lob.freetemporary(v_xml);
END;
/
Error
ORA-06502: PL/SQL: numeric or value error
ORA-06512: at "SYS.OWA_UTIL", line 356
ORA-06512: at "SYS.OWA_UTIL", line 404
ORA-06512: at "RECOPS.SP_RSSFEED", line 55
ORA-06512: at line 6
Please help me out how to resolve this errors
Regards
Sandeep