473,386 Members | 1,752 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Spooling Techniques.....

1
I have to write a procedure using spooling techniques where the procedure will take some data from a table and will write it in a file defined in the spool command. I'm giving the procedure........previously it was done using utl_file but now we need spooling for that...... the target path is \xyz.........

CREATE OR REPLACE PROCEDURE PROC_FILE_GENERATOR AS
CURSOR C1 IS
SELECT DISTINCT SERVICE_NUM FROM L_EDW_BB_AVAILABILITY_MASTER GROUP BY SERVICE_NUM ;
V_FILE_HANDLE UTL_FILE.FILE_TYPE;
V_INPUT_FILE UTL_FILE.FILE_TYPE;
V_FILE_NAME VARCHAR2(50);
V_LINE VARCHAR2(1000);
V_HEADER VARCHAR2(1);
v_record_count number(8);
v_DN_count number(8);
V_FILE_NAME_READ VARCHAR2(50);
INPUT_BUFFER varchar2(4000);
V_DATE VARCHAR2(8);
BEGIN
V_FILE_NAME := 'wholesale.dat';
V_FILE_HANDLE := UTL_FILE.FOPEN('/xyz',V_FILE_NAME,'W');
select to_CHAR(sysdate,'DDMMYYYY') INTO V_DATE FROM DUAL;
V_LINE := '0,BT RETAIL,BBCHECK,'||V_DATE||',V1,F1,V2';
UTL_FILE.PUT_LINE(V_FILE_HANDLE, V_LINE);
V_FILE_NAME_READ:='contact_info.dat';
V_INPUT_FILE:=UTL_FILE.FOPEN('/xyz',V_FILE_NAME_READ,'R');
utl_file.get_line (V_INPUT_FILE,INPUT_BUFFER);
--dbms_output.put_line(input_buffer);
UTL_FILE.PUT_LINE(V_FILE_HANDLE,INPUT_BUFFER);
utl_file.fclose(V_INPUT_FILE);
FOR REC1 IN C1
LOOP
EXIT WHEN C1%NOTFOUND;
V_LINE := '7'|| ',' || REC1.SERVICE_NUM ;
UTL_FILE.PUT_LINE(V_FILE_HANDLE, V_LINE);
v_DN_count:=c1%ROWCOUNT;
v_record_count:=3+v_DN_count;
END LOOP;
V_LINE:='9'||','||V_record_COUNT||','||v_DN_count;
UTL_FILE.PUT_LINE(V_FILE_HANDLE, V_LINE);
UTL_FILE.FCLOSE(V_FILE_HANDLE);
END PROC_FILE_GENERATOR;

please help in resolving this..............
Jan 10 '07 #1
0 1722

Sign in to post your reply or Sign up for a free account.

Similar topics

25
by: JW | last post by:
I'm putting together a bulletin board system for a community that allows folks to put up for sale postings, notices, etc. These notices usually include the posters' email addresses. A similar...
15
by: christopher diggins | last post by:
I have written an article on how to do Aspect Oriented Programming in vanilla C++ (i.e. without language extensions or other tools such as AspectC++). The article is available at...
0
by: Zentil | last post by:
While printing reports Spooling of print document size get increased into larger size ie the document size is 260kb but on spooling it increased to 268mb. but this is happening in some systems...
2
by: Martin | last post by:
I already know some techniques for writing small footprint software, but now I need to really squeeze the software I'm writing into a small space (embedded software). Is there a good web page...
19
by: JoeC | last post by:
I have seen many books that teack coding for C++. What are ways to improve my techniques for writing larger programs. I have written many demo programs learning some aspects of code wether it be...
16
by: Panos Laganakos | last post by:
I've been thinking if there's a point in applying some specific OOP techniques in Python as we do in other languages. i.e. we usually define private properties and provide public functions to...
6
by: Maitre Bart | last post by:
One said: "The more time you'll spend on designing your app, the less you'll spend time debugging it." I agree with that, but chances are, you'll still need to debug it anyway! And the larger the...
2
by: prakashtambare | last post by:
Hi all, Myself Prakash I am new to this forum and I am working as a software engineer but also I am just a fresher into the software industry, also my work is related to c source code optimization...
0
by: gp | last post by:
I am and have been using PDO for about a year now...and have finally gotten around to solving the "DB NULL value" issues I ran into early on... I am looking for suggestions and techniques to...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.