399: PROCEDURE WritetoXML (
400: p_request_id in number,
401: p_output_fname out nocopy varchar2)
402: IS
403: p_l_fp UTL_FILE.FILE_TYPE;
404: l_audit_log_dir varchar2(500) := '/sqlcom/outbound';
405: l_file_name varchar2(50);
406: l_check_flag number;
407: BEGIN
418:
419: SELECT value
420: INTO l_audit_log_dir
421: FROM v$parameter
422: WHERE LOWER(name) = 'utl_file_dir';
423: -- Check whether more than one util file directory is found
424: IF INSTR(l_audit_log_dir,',') > 0 THEN
425: l_audit_log_dir := substr(l_audit_log_dir,1,instr(l_audit_log_dir,',')-1);
426: END IF;
435: ELSE
436: p_output_fname := l_audit_log_dir || '\' || l_file_name;
437: END IF;
438: -- getting Agency name
439: p_l_fp := utl_file.fopen(l_audit_log_dir,l_file_name,'A');
440: utl_file.put_line(p_l_fp,'');
441: utl_file.put_line(p_l_fp,'
442: -- Writing from and to dates
443: utl_file.put_line(p_l_fp,'
436: p_output_fname := l_audit_log_dir || '\' || l_file_name;
437: END IF;
438: -- getting Agency name
439: p_l_fp := utl_file.fopen(l_audit_log_dir,l_file_name,'A');
440: utl_file.put_line(p_l_fp,'');
441: utl_file.put_line(p_l_fp,'
442: -- Writing from and to dates
443: utl_file.put_line(p_l_fp,'
444: -- Write the header fields to XML File.
437: END IF;
438: -- getting Agency name
439: p_l_fp := utl_file.fopen(l_audit_log_dir,l_file_name,'A');
440: utl_file.put_line(p_l_fp,'');
441: utl_file.put_line(p_l_fp,'
443: utl_file.put_line(p_l_fp,'
444: -- Write the header fields to XML File.
445: --WriteXMLvalues(p_l_fp,'P0_from_date',to_char(p_from_date,'dd') || ' ' || trim(to_char(p_from_date,'Month')) || ' ' || to_char(p_from_date,'yyyy') );
439: p_l_fp := utl_file.fopen(l_audit_log_dir,l_file_name,'A');
440: utl_file.put_line(p_l_fp,'');
441: utl_file.put_line(p_l_fp,'
442: -- Writing from and to dates
443: utl_file.put_line(p_l_fp,'
445: --WriteXMLvalues(p_l_fp,'P0_from_date',to_char(p_from_date,'dd') || ' ' || trim(to_char(p_from_date,'Month')) || ' ' || to_char(p_from_date,'yyyy') );
446: --WriteXMLvalues(p_l_fp,'P0_to_date',to_char(p_to_date,'dd') || ' ' ||to_char(p_to_date,'Month') || ' ' || to_char(p_to_date,'yyyy') );
447: -- Loop through PL/SQL Table and write the values into the XML File.
454: WriteXMLvalues(p_l_fp,vXMLTable(ctr_table).TagName,vXMLTable(ctr_table).TagValue);
455: END LOOP;
456: END IF;
457: -- Write the end tag and close the XML File.
458: utl_file.put_line(p_l_fp,'');
459: utl_file.put_line(p_l_fp,'');
460: utl_file.fclose(p_l_fp);
461: /*Msg in the temorary table*/
462: --insert into tstmsg values('Leaving the procedure WritetoXML.');
455: END LOOP;
456: END IF;
457: -- Write the end tag and close the XML File.
458: utl_file.put_line(p_l_fp,'');
459: utl_file.put_line(p_l_fp,'');
460: utl_file.fclose(p_l_fp);
461: /*Msg in the temorary table*/
462: --insert into tstmsg values('Leaving the procedure WritetoXML.');
463: END WritetoXML;
456: END IF;
457: -- Write the end tag and close the XML File.
458: utl_file.put_line(p_l_fp,'');
459: utl_file.put_line(p_l_fp,'');
460: utl_file.fclose(p_l_fp);
461: /*Msg in the temorary table*/
462: --insert into tstmsg values('Leaving the procedure WritetoXML.');
463: END WritetoXML;
464:
469: |Description : Procedure to write the xml values. Used for debugging |
470: ------------------------------------------------------------------------------*/
471:
472:
473: PROCEDURE WriteXMLvalues( p_l_fp utl_file.file_type,p_tagname IN VARCHAR2, p_value IN VARCHAR2) IS
474: BEGIN
475: -- Writing XML Tag and values to XML File
476: -- utl_file.put_line(p_l_fp,'<' || p_tagname || '>' || p_value || '' );
477: -- New Format XFDF
472:
473: PROCEDURE WriteXMLvalues( p_l_fp utl_file.file_type,p_tagname IN VARCHAR2, p_value IN VARCHAR2) IS
474: BEGIN
475: -- Writing XML Tag and values to XML File
476: -- utl_file.put_line(p_l_fp,'<' || p_tagname || '>' || p_value || '' );
477: -- New Format XFDF
478: utl_file.put_line(p_l_fp,'
479: utl_file.put_line(p_l_fp,'
480: utl_file.put_line(p_l_fp,'
474: BEGIN
475: -- Writing XML Tag and values to XML File
476: -- utl_file.put_line(p_l_fp,'<' || p_tagname || '>' || p_value || '' );
477: -- New Format XFDF
478: utl_file.put_line(p_l_fp,'
480: utl_file.put_line(p_l_fp,'');
481: END WriteXMLvalues;
482:
475: -- Writing XML Tag and values to XML File
476: -- utl_file.put_line(p_l_fp,'<' || p_tagname || '>' || p_value || '' );
477: -- New Format XFDF
478: utl_file.put_line(p_l_fp,'
479: utl_file.put_line(p_l_fp,'
480: utl_file.put_line(p_l_fp,'
481: END WriteXMLvalues;
482:
483: /*-------------------------------------------------------------------------------
476: -- utl_file.put_line(p_l_fp,'<' || p_tagname || '>' || p_value || '' );
477: -- New Format XFDF
478: utl_file.put_line(p_l_fp,'
479: utl_file.put_line(p_l_fp,'
480: utl_file.put_line(p_l_fp,'
481: END WriteXMLvalues;
482:
483: /*-------------------------------------------------------------------------------
484: |Name : WritetoXML_rtf |
492: PROCEDURE WritetoXML_rtf (
493: p_request_id in number,
494: p_output_fname out nocopy varchar2)
495: IS
496: p_l_fp UTL_FILE.FILE_TYPE;
497: l_audit_log_dir varchar2(500) := '/sqlcom/outbound';
498: l_file_name varchar2(50);
499: l_check_flag number;
500: l_concat_str VARCHAR2(32000);
512:
513: SELECT value
514: INTO l_audit_log_dir
515: FROM v$parameter
516: WHERE LOWER(name) = 'utl_file_dir';
517: -- Check whether more than one util file directory is found
518: IF INSTR(l_audit_log_dir,',') > 0 THEN
519: l_audit_log_dir := substr(l_audit_log_dir,1,instr(l_audit_log_dir,',')-1);
520: END IF;
529: ELSE
530: p_output_fname := l_audit_log_dir || '\' || l_file_name;
531: END IF;
532: -- getting Agency name
533: p_l_fp := utl_file.fopen(l_audit_log_dir,l_file_name,'A',32000);
534: -- Writing from and to dates
535: l_concat_str := '';
536: l_concat_str := l_concat_str||'
537: --utl_file.put_line(p_l_fp,'
533: p_l_fp := utl_file.fopen(l_audit_log_dir,l_file_name,'A',32000);
534: -- Writing from and to dates
535: l_concat_str := '';
536: l_concat_str := l_concat_str||'
537: --utl_file.put_line(p_l_fp,'
539: --WriteXMLvalues(p_l_fp,'P0_from_date',to_char(p_from_date,'dd') || ' ' || trim(to_char(p_from_date,'Month')) || ' ' || to_char(p_from_date,'yyyy') );
540: --WriteXMLvalues(p_l_fp,'P0_to_date',to_char(p_to_date,'dd') || ' ' ||to_char(p_to_date,'Month') || ' ' || to_char(p_to_date,'yyyy') );
541: -- Loop through PL/SQL Table and write the values into the XML File.
545: FOR ctr_table IN vXMLTable.FIRST .. vXMLTable.LAST LOOP
546:
547: IF length(l_concat_str) > 28000 THEN
548:
549: utl_file.put_line(p_l_fp,l_concat_str);
550: l_concat_str := '';
551:
552: END IF;
553:
569: --WriteXMLvalues_rtf(p_l_fp,vXMLTable(ctr_table).TagName,vXMLTable(ctr_table).TagValue);
570: END LOOP;
571: END IF;
572: IF length(l_concat_str) > 0 THEN
573: utl_file.put_line(p_l_fp,l_concat_str);
574: END IF;
575: -- Write the end tag and close the XML File.
576: utl_file.put_line(p_l_fp,'');
577: utl_file.fclose(p_l_fp);
572: IF length(l_concat_str) > 0 THEN
573: utl_file.put_line(p_l_fp,l_concat_str);
574: END IF;
575: -- Write the end tag and close the XML File.
576: utl_file.put_line(p_l_fp,'');
577: utl_file.fclose(p_l_fp);
578: /*Msg in the temorary table*/
579: --insert into tstmsg values('Leaving the procedure WritetoXML.');
580: END WritetoXML_rtf;
573: utl_file.put_line(p_l_fp,l_concat_str);
574: END IF;
575: -- Write the end tag and close the XML File.
576: utl_file.put_line(p_l_fp,'');
577: utl_file.fclose(p_l_fp);
578: /*Msg in the temorary table*/
579: --insert into tstmsg values('Leaving the procedure WritetoXML.');
580: END WritetoXML_rtf;
581:
579: --insert into tstmsg values('Leaving the procedure WritetoXML.');
580: END WritetoXML_rtf;
581:
582: /*Function to support building of xml file compatible with RTF processor */
583: PROCEDURE WriteXMLvalues_rtf( p_l_fp utl_file.file_type,p_tagname IN VARCHAR2, p_value IN VARCHAR2) IS
584: BEGIN
585: -- Writing XML Tag and values to XML File
586: -- utl_file.put_line(p_l_fp,'<' || p_tagname || '>' || p_value || '' );
587: -- New Format XFDF
582: /*Function to support building of xml file compatible with RTF processor */
583: PROCEDURE WriteXMLvalues_rtf( p_l_fp utl_file.file_type,p_tagname IN VARCHAR2, p_value IN VARCHAR2) IS
584: BEGIN
585: -- Writing XML Tag and values to XML File
586: -- utl_file.put_line(p_l_fp,'<' || p_tagname || '>' || p_value || '' );
587: -- New Format XFDF
588: utl_file.put_line(p_l_fp,'<' || p_tagname || '>');
589: utl_file.put_line(p_l_fp,'
590: utl_file.put_line(p_l_fp,'');
584: BEGIN
585: -- Writing XML Tag and values to XML File
586: -- utl_file.put_line(p_l_fp,'<' || p_tagname || '>' || p_value || '' );
587: -- New Format XFDF
588: utl_file.put_line(p_l_fp,'<' || p_tagname || '>');
589: utl_file.put_line(p_l_fp,'
590: utl_file.put_line(p_l_fp,'');
591: END WriteXMLvalues_rtf;
592:
585: -- Writing XML Tag and values to XML File
586: -- utl_file.put_line(p_l_fp,'<' || p_tagname || '>' || p_value || '' );
587: -- New Format XFDF
588: utl_file.put_line(p_l_fp,'<' || p_tagname || '>');
589: utl_file.put_line(p_l_fp,'
590: utl_file.put_line(p_l_fp,'');
591: END WriteXMLvalues_rtf;
592:
593:
586: -- utl_file.put_line(p_l_fp,'<' || p_tagname || '>' || p_value || '' );
587: -- New Format XFDF
588: utl_file.put_line(p_l_fp,'<' || p_tagname || '>');
589: utl_file.put_line(p_l_fp,'
590: utl_file.put_line(p_l_fp,'');
591: END WriteXMLvalues_rtf;
592:
593:
594: