Save lines to a file : File Write with UTL_FILE « System Packages « Oracle PL/SQL Tutorial

Oracle PL/SQL Tutorial
1. Introduction
2. Query Select
3. Set
4. Insert Update Delete
5. Sequences
6. Table
7. Table Joins
8. View
9. Index
10. SQL Data Types
11. Character String Functions
12. Aggregate Functions
13. Date Timestamp Functions
14. Numerical Math Functions
15. Conversion Functions
16. Analytical Functions
17. Miscellaneous Functions
18. Regular Expressions Functions
19. Statistical Functions
20. Linear Regression Functions
21. PL SQL Data Types
22. PL SQL Statements
23. PL SQL Operators
24. PL SQL Programming
25. Cursor
26. Collections
27. Function Procedure Packages
28. Trigger
29. SQL PLUS Session Environment
30. System Tables Data Dictionary
31. System Packages
32. Object Oriented
33. XML
34. Large Objects
35. Transaction
36. User Privilege
Java
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Oracle PL/SQL Tutorial » System Packages » File Write with UTL_FILE 
31. 35. 3. Save lines to a file
SQL>
SQL> CREATE OR REPLACE PROCEDURE put_line
  2     (file_in IN UTL_FILE.FILE_TYPE,
  3      line_in IN VARCHAR2,
  4      
  5      max_line_size_in IN INTEGER := 1023)
  6  IS
  7     v_line VARCHAR2(32767);
  8     v_linelen CONSTANT INTEGER := LENGTH (line);
  9     v_start INTEGER := 1;
 10     v_max CONSTANT INTEGER := max_line_size_in - 1;
 11  BEGIN
 12     LOOP
 13        EXIT WHEN v_start > v_linelen OR v_linelen IS NULL;
 14        v_line := SUBSTR (line_in, v_start, v_max);
 15        IF v_start + v_max < v_linelen
 16        THEN
 17           v_line := v_line || '-';
 18        END IF;
 19        UTL_FILE.PUT_LINE (file_in, v_line);
 20        v_start := v_start + v_max;
 21     END LOOP;
 22  END;
 23  /
31. 35. File Write with UTL_FILE
31. 35. 1. Open the output file for writing
31. 35. 2. Save string to a file with UTL_FILE.PUTF
31. 35. 3. Save lines to a file
31. 35. 4. Write text to a file with UTL_FILE package
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.