Guest_imported
New member
- Jan 1, 1970
- 0
This site has saved a lot of jobs including mine.
I have a couple more that I hope I can get help on.
One, I am trying to write an utl_file package that
is intended to produce an html code.
My questions are 1, does utl_file package work with
win2000?, 2, how do I test it?
I have set up an utl_file directory in init.ora.
Please take a look at this code and tell what is wrong
with it. It is compiling but I cannot see the result
anywhere. How do I check it to see that it is doing
what I intennd it to do?
CREATE OR REPLACE PROCEDURE Cr_Movie_PRV_HTML(
P_FileName IN VARCHAR2,
p_Id IN Movie.Movie_Id%TYPE
)
AS
CURSOR C_Movie_Detail IS
SELECT MOVIE_ID,
MOVIE_NAME,
MOVIE_TYPE_FLAG,
MOVIE_LANGUAGE_FLAG,
DESCRIPTION,
DIRECTOR,
GENRE,
PLAYING_TIME,
PRODUCER,
STUDIO,
RELEASE_DATE,
Movie_RATING,
VIDEO_RELEASE_DATE,
ACTIVE_DATE,
INACTIVE_DATE
FROM Movie
WHERE Movie_Id = P_Id;
V_FileHandle UTL_FILE.FILE_TYPE; -- This will be used to store the filename
BEGIN
DBMS_OUTPUT.ENABLE(1000000);
-- Open The specified file to write into and get V_FileHandle.
V_FileHandle := UTL_FILE.FOPEN('d:\',P_FileName, 'W');
EXCEPTION
WHEN Utl_File.Invalid_Path THEN
RAISE_APPLICATION_ERROR(-2000, 'Error opening'||P_FileName||'for WRITE');
-- V_FileHandle := UTL_FILE.FCLOSE('d:\',P_FileName, 'W');
-- Reopen The specified file to write into and get V_FileHandle.
V_FileHandle := UTL_FILE.FOPEN('d:\',P_FileName, 'W');
-- Let's build the header file that will be inside the file
utl_file.put_line(V_FileHandle,'#------------------------------------------------------------------');
utl_file.put_line(V_FileHandle,'# Generated on: '||to_char(sysdate, 'Mon DD, YYYY (Dy) HH:MI:SS AM'));
utl_file.put_line(V_FileHandle,'#------------------------------------------------------------------');
utl_file.put_line(V_FileHandle,' ');
-- Next we will query data from the Movie table. Only data that are relevant.
-- Using PUT_LINE, write text with the field arguments out to the file
BEGIN
FOR Movie_Rec IN C_Movie_Detail LOOP
UTL_FILE.PUT_LINE(V_FileHandle, TO_CHAR(Movie_Rec.Movie_Id)||','||Movie_Rec.Movie_Name||','||
Movie_Rec.Movie_Type_Flag||','||Movie_Rec.Movie_Language_Flag||','||
Movie_Rec.Description||','||Movie_Rec.Genre||','||Movie_Rec.Director||','||
Movie_Rec.Playing_Time||','||Movie_Rec.Producer||','||Movie_Rec.Studio||','||
Movie_Rec.Release_Date||','||Movie_Rec.Movie_Rating||','||
Movie_Rec.Video_Release_Date||','||Movie_Rec.Active_Date||','||
Movie_Rec.Inactive_Date);
END LOOP;
END;
-- Now Close the file
UTL_FILE.FCLOSE( V_FileHandle);
END Cr_Movie_PRV_HTML;
/*******************************************End Movie procedure*******************************************/
/
In a totally unrelated case, I am trying to start service
for oracle management server but I am running into error 997
which in part means that "I cannot start oms on local computer because overlapped i/o operation in progress"
Sorry folks about the long thread.
toaft
I have a couple more that I hope I can get help on.
One, I am trying to write an utl_file package that
is intended to produce an html code.
My questions are 1, does utl_file package work with
win2000?, 2, how do I test it?
I have set up an utl_file directory in init.ora.
Please take a look at this code and tell what is wrong
with it. It is compiling but I cannot see the result
anywhere. How do I check it to see that it is doing
what I intennd it to do?
CREATE OR REPLACE PROCEDURE Cr_Movie_PRV_HTML(
P_FileName IN VARCHAR2,
p_Id IN Movie.Movie_Id%TYPE
)
AS
CURSOR C_Movie_Detail IS
SELECT MOVIE_ID,
MOVIE_NAME,
MOVIE_TYPE_FLAG,
MOVIE_LANGUAGE_FLAG,
DESCRIPTION,
DIRECTOR,
GENRE,
PLAYING_TIME,
PRODUCER,
STUDIO,
RELEASE_DATE,
Movie_RATING,
VIDEO_RELEASE_DATE,
ACTIVE_DATE,
INACTIVE_DATE
FROM Movie
WHERE Movie_Id = P_Id;
V_FileHandle UTL_FILE.FILE_TYPE; -- This will be used to store the filename
BEGIN
DBMS_OUTPUT.ENABLE(1000000);
-- Open The specified file to write into and get V_FileHandle.
V_FileHandle := UTL_FILE.FOPEN('d:\',P_FileName, 'W');
EXCEPTION
WHEN Utl_File.Invalid_Path THEN
RAISE_APPLICATION_ERROR(-2000, 'Error opening'||P_FileName||'for WRITE');
-- V_FileHandle := UTL_FILE.FCLOSE('d:\',P_FileName, 'W');
-- Reopen The specified file to write into and get V_FileHandle.
V_FileHandle := UTL_FILE.FOPEN('d:\',P_FileName, 'W');
-- Let's build the header file that will be inside the file
utl_file.put_line(V_FileHandle,'#------------------------------------------------------------------');
utl_file.put_line(V_FileHandle,'# Generated on: '||to_char(sysdate, 'Mon DD, YYYY (Dy) HH:MI:SS AM'));
utl_file.put_line(V_FileHandle,'#------------------------------------------------------------------');
utl_file.put_line(V_FileHandle,' ');
-- Next we will query data from the Movie table. Only data that are relevant.
-- Using PUT_LINE, write text with the field arguments out to the file
BEGIN
FOR Movie_Rec IN C_Movie_Detail LOOP
UTL_FILE.PUT_LINE(V_FileHandle, TO_CHAR(Movie_Rec.Movie_Id)||','||Movie_Rec.Movie_Name||','||
Movie_Rec.Movie_Type_Flag||','||Movie_Rec.Movie_Language_Flag||','||
Movie_Rec.Description||','||Movie_Rec.Genre||','||Movie_Rec.Director||','||
Movie_Rec.Playing_Time||','||Movie_Rec.Producer||','||Movie_Rec.Studio||','||
Movie_Rec.Release_Date||','||Movie_Rec.Movie_Rating||','||
Movie_Rec.Video_Release_Date||','||Movie_Rec.Active_Date||','||
Movie_Rec.Inactive_Date);
END LOOP;
END;
-- Now Close the file
UTL_FILE.FCLOSE( V_FileHandle);
END Cr_Movie_PRV_HTML;
/*******************************************End Movie procedure*******************************************/
/
In a totally unrelated case, I am trying to start service
for oracle management server but I am running into error 997
which in part means that "I cannot start oms on local computer because overlapped i/o operation in progress"
Sorry folks about the long thread.
toaft