Databases Reference
In-Depth Information
549 AS
550 BEGIN
551 sp_print_json(
552 p_author => NULL,
553 p_title => NULL,
554 p_content => NULL,
555 p_link => null,
556 p_error_msg => p_error_msg);
557 END sp_print_error_msg;
558
559 BEGIN
560
561 IF v_rss_type = 'blogger' THEN
562 -- Get blog details
563 DECLARE
564 http_request_failed EXCEPTION;
565 PRAGMA EXCEPTION_INIT(http_request_failed, -29273);
566 BEGIN
567 SELECT author, title, CONTENT, LINK
568 INTO v_author, v_title, v_content, v_link
569 FROM xmltable(
570 XMLNAMESPACES(DEFAULT ' http://www.w3.org/2005/Atom'),
571 '*' passing httpuritype
(v_rss_url).getxml().EXTRACT('//feed/entry','xmlns=" http://www.w3.org/2005/Atom"')
572 COLUMNS ID VARCHAR2(4000) path 'id',
573 title VARCHAR2(48) path 'title',
574 link VARCHAR2(1000) path 'link[@rel="alternate"]/@href',
575 author VARCHAR2(1000) path 'author/name',
576 content CLOB PATH 'content')
577 WHERE ID = v_rss_id;
578
579 sp_print_json(
580 p_author => v_author,
581 p_title => v_title,
582 p_content => v_content,
583 p_link => v_link);
584
585 EXCEPTION
586 WHEN NO_DATA_FOUND THEN
587 sp_print_error_msg(p_error_msg => 'Invalid RSS ID');
588 WHEN TOO_MANY_ROWS THEN
589 sp_print_error_msg(p_error_msg => 'RSS ID returned multiple matches');
590 WHEN http_request_failed THEN
591 sp_print_error_msg(p_error_msg => 'HTTP Connection Error');
592 WHEN OTHERS THEN
593 sp_print_error_msg(p_error_msg => 'Unknown Error');
594 END; -- Select
595
596 -- Add more RSS type support here
597 ELSE
598 -- Return error message
599 sp_print_error_msg(p_error_msg => 'Unknown RSS Type');
 
Search WWH ::




Custom Search