Does PLDoc Utility support Package and Package Body output in the same SQL file.
Does PLDoc Utility support UTL_FILE operations. As this does not seem to be working. I get the following error message when trying to generate PLdocumentation:
PLDoc version: 0.8.3
Parsing file d:\sql\COREMETRICS.SQL ...
Error parsing line 80, column 14
Last consumed token: "UTL_FILE"
net.sourceforge.pldoc.parser.ParseException: Encountered "." at line 80, column
14.
Was expecting:
"THEN" ...
at net.sourceforge.pldoc.parser.PLSQLParser.generateParseException(PLSQL
Parser.java:12003)
at net.sourceforge.pldoc.parser.PLSQLParser.jj_consume_token(PLSQLParser
.java:11862)
at net.sourceforge.pldoc.parser.PLSQLParser.programUnit(PLSQLParser.java
:1875)
at net.sourceforge.pldoc.parser.PLSQLParser.declarativeSection(PLSQLPars
er.java:1477)
at net.sourceforge.pldoc.parser.PLSQLParser.packageBody(PLSQLParser.java
:802)
at net.sourceforge.pldoc.parser.PLSQLParser.input(PLSQLParser.java:333)
at net.sourceforge.pldoc.PLDoc.processPackage(PLDoc.java:282)
at net.sourceforge.pldoc.PLDoc.run(PLDoc.java:139)
at net.sourceforge.pldoc.PLDoc.main(PLDoc.java:86)
File d:\sql\COREMETRICS.SQL skipped.
Generating HTML files ...
Generating allschemas.html ...
Generating summary.html ...
Generating allpackages.html ...
Generating index.html ...
Generating <unit>.html ...
Done (0.89 seconds).
PROCEDURE createCDFFile(p_logPath IN VARCHAR2,in_locale VARCHAR2,in_client_id NUMBER);
END COREMETRICS;
/
CREATE OR REPLACE PACKAGE BODY BVUSER.COREMETRICS IS
/** Function to initialise an output file.
* @param p_directorty The directory path for the file
* @param p_process_name The process name that will be used in the filename
* @param p_header The header text for the file
* @return file handle
*/
FUNCTION init(p_directory IN VARCHAR2,
p_process_name IN VARCHAR2,
p_header IN VARCHAR2 DEFAULT 'Y') RETURN UTL_FILE.FILE_TYPE IS
g_filehandle := UTL_FILE.FOPEN(p_directory, l_filename, 'W');
UTL_FILE.PUT_LINE(g_filehandle, 'Log Started on : '||TO_CHAR(SYSDATE, 'DD-MON-YYYY HH24:MI:SS'));
UTL_FILE.NEW_LINE(g_filehandle);
return g_filehandle;
EXCEPTION
WHEN UTL_FILE.INVALID_OPERATION THEN
Dci_Error_Pr.WRITE_ERROR(p_directory,'Logging Process', 'Cannot Open File for Write - File is not writeable/createable');
WHEN OTHERS THEN
NULL;
END;
/** Procedure to output text to a file.
* @param p_filehandle The pointer / handle to the output file
* @param p_text The text to output to the file
*/
PROCEDURE writeLog(p_filehandle UTL_FILE.FILE_TYPE, p_text VARCHAR2) AS
BEGIN
--Dci_Log_Pr.write_log(g_logName,TO_CHAR(SYSDATE,'HH24:MI:SS')||' '||p_text);
-- Dci_Log_Pr.write_log('BVT_ORDER_PROCESSOR',TO_CHAR(SYSDATE,'HH24:MI:SS')||' '||p_text);
UTL_FILE.PUT_LINE(p_filehandle, p_text);
END writeLog;
/** Procedure to output text to a file.
* @param p_filehandle The pointer / handle to the output file
* @param p_process_name The process name to be used as part of the filename
* @param p_footer The text to output at the end of the file
*/
PROCEDURE Close_Log(p_filehandle UTL_FILE.FILE_TYPE,
p_process_name IN VARCHAR2,
p_footer IN VARCHAR2 DEFAULT 'Y') IS
l_dummy VARCHAR2(5);
BEGIN
UTL_FILE.NEW_LINE(p_filehandle);
IF (p_footer = 'Y') THEN
UTL_FILE.PUT_LINE(p_filehandle, 'Log Ended on : '||TO_CHAR(SYSDATE, 'DD-MON-YYYY HH24:MI:SS'));
END IF;
g_filehandle:=p_filehandle;
UTL_FILE.FCLOSE(g_filehandle);
EXCEPTION
WHEN OTHERS THEN
NULL;
END;
/** Procedure to output text to a file.
* @param in_file The pointer / handle to the output file
* @param in_text The text to output to the file
*/
PROCEDURE writeLine(in_file UTL_FILE.FILE_TYPE,in_text VARCHAR2)
AS
BEGIN
UTL_FILE.PUT_LINE(in_file,in_text);
END writeLine;
/** Procedure to create a coremetrics data file in CSV format for all locales of a store.
* There may be multiple locales for a store. In this case the date is output for each locale in turn.
* @param p_logPath The path for creating the file
* @param in_locale The store to create the file for.
* @param in_client_id The id used to identify the file
*/
PROCEDURE createCDFFile(p_logPath IN VARCHAR2,in_locale VARCHAR2,in_client_id NUMBER) AS
-- locale variables
v_filehandle UTL_FILE.FILE_TYPE;
v_dataRecord max_vc2;
v_outputFileName VARCHAR2(26);
v_outputFile UTL_FILE.FILE_TYPE;
v_RecordCount NUMBER;
v_store_id NUMBER;
BEGIN
-- Initialise log files
v_filehandle:=init(p_logPath,g_logName);
writelog(v_filehandle,'Beginning cdf file extract for locale: ' || in_locale);
v_RecordCount := 0;
-- Open data file and output detalls to log.
v_outputFileName := in_client_id|| '.csv';
v_outputFile := UTL_FILE.FOPEN('/u01/hausers/eitctran/data', v_outputFileName, 'w', 32000);
writelog(v_filehandle,'Files opened');
writelog(v_filehandle,'Getting locales for store ' || in_locale || ' ...');
-- Get store id for the locale and then retrieve all locales for this store.
v_store_id:=Ecc_utils.get_store_id(upper(in_locale));
SELECT DISTINCT (value)
BULK COLLECT INTO pltab_locale
FROM ITC_CONTROL
WHERE store_id = v_store_id
AND usage = 'STORE_CONFIG_CUSTOMER';
Does PLDoc Utility support Package and Package Body output in the same SQL file.
Does PLDoc Utility support UTL_FILE operations. As this does not seem to be working. I get the following error message when trying to generate PLdocumentation:
D:\pldoc>call pldoc.bat -doctitle 'CoreMetrics' -overview samples/overview1.html
-d RakSampleApplicationDoc d:\sql\COREMETRICS.SQL
PLDoc version: 0.8.3
Parsing file d:\sql\COREMETRICS.SQL ...
Error parsing line 80, column 14
Last consumed token: "UTL_FILE"
net.sourceforge.pldoc.parser.ParseException: Encountered "." at line 80, column
14.
Was expecting:
"THEN" ...
at net.sourceforge.pldoc.parser.PLSQLParser.generateParseException(PLSQL
Parser.java:12003)
at net.sourceforge.pldoc.parser.PLSQLParser.jj_consume_token(PLSQLParser
.java:11862)
at net.sourceforge.pldoc.parser.PLSQLParser.programUnit(PLSQLParser.java
:1875)
at net.sourceforge.pldoc.parser.PLSQLParser.declarativeSection(PLSQLPars
er.java:1477)
at net.sourceforge.pldoc.parser.PLSQLParser.packageBody(PLSQLParser.java
:802)
at net.sourceforge.pldoc.parser.PLSQLParser.input(PLSQLParser.java:333)
at net.sourceforge.pldoc.PLDoc.processPackage(PLDoc.java:282)
at net.sourceforge.pldoc.PLDoc.run(PLDoc.java:139)
at net.sourceforge.pldoc.PLDoc.main(PLDoc.java:86)
File d:\sql\COREMETRICS.SQL skipped.
Generating HTML files ...
Generating allschemas.html ...
Generating summary.html ...
Generating allpackages.html ...
Generating index.html ...
Generating <unit>.html ...
Done (0.89 seconds).
The code in question is as follows:
CREATE OR REPLACE PACKAGE BVUSER.COREMETRICS IS
/******************************************************************************
NAME: coremetrics
PURPOSE: coremetrics utilities.
REVISIONS:
Ver Date Author Description
--- ---- ------ -----------
1.0 03/14/07 Rakesh Parmar New package.
*****************************************************************************/
-- Avoid hard coding multiple instances of large varchar2
SUBTYPE max_vc2 IS VARCHAR2(32000);
-- Globals
g_logName VARCHAR2(128):='CDFFile';
g_filehandle UTL_FILE.FILE_TYPE;
g_storeName bv_store.store_name%TYPE;
g_storeID bv_store.store_id%TYPE;
g_outputFileName VARCHAR2(50);
g_outputFile UTL_FILE.FILE_TYPE;
g_debugOn BOOLEAN := TRUE;
v_OrderNumber VARCHAR2(128);
v_ErrorMsg VARCHAR2(255);
n_Error NUMBER;
-- data collections
TYPE type_pltab_small_varchar2 IS TABLE OF VARCHAR2(265) INDEX BY PLS_INTEGER;
pltab_ctp_class_id type_pltab_small_varchar2;
pltab_parent_ctp_class_id type_pltab_small_varchar2;
pltab_name type_pltab_small_varchar2;
pltab_client_id type_pltab_small_varchar2;
pltab_locale type_pltab_small_varchar2;
v_count NUMBER;
v_tmp NUMBER;
--v_NumberOfUsers NUMBER;
--v_NumberOfProductsInList1 NUMBER;
--v_NumberOfProductsInList2 NUMBER;
--v_NumberOfProductsInList3 NUMBER;
--v_NumberOfProductsInList4 NUMBER;
PROCEDURE createCDFFile(p_logPath IN VARCHAR2,in_locale VARCHAR2,in_client_id NUMBER);
END COREMETRICS;
/
CREATE OR REPLACE PACKAGE BODY BVUSER.COREMETRICS IS
/** Function to initialise an output file.
* @param p_directorty The directory path for the file
* @param p_process_name The process name that will be used in the filename
* @param p_header The header text for the file
* @return file handle
*/
FUNCTION init(p_directory IN VARCHAR2,
p_process_name IN VARCHAR2,
p_header IN VARCHAR2 DEFAULT 'Y') RETURN UTL_FILE.FILE_TYPE IS
l_filename VARCHAR2(240) := p_process_name||'_'||TO_CHAR(SYSDATE,'ddmmyyhh24miss')||'.log';
BEGIN
g_filehandle := UTL_FILE.FOPEN(p_directory, l_filename, 'W');
UTL_FILE.PUT_LINE(g_filehandle, 'Log Started on : '||TO_CHAR(SYSDATE, 'DD-MON-YYYY HH24:MI:SS'));
UTL_FILE.NEW_LINE(g_filehandle);
return g_filehandle;
EXCEPTION
WHEN UTL_FILE.INVALID_OPERATION THEN
Dci_Error_Pr.WRITE_ERROR(p_directory,'Logging Process', 'Cannot Open File for Write - File is not writeable/createable');
WHEN OTHERS THEN
NULL;
END;
/** Procedure to output text to a file.
* @param p_filehandle The pointer / handle to the output file
* @param p_text The text to output to the file
*/
PROCEDURE writeLog(p_filehandle UTL_FILE.FILE_TYPE, p_text VARCHAR2) AS
BEGIN
--Dci_Log_Pr.write_log(g_logName,TO_CHAR(SYSDATE,'HH24:MI:SS')||' '||p_text);
-- Dci_Log_Pr.write_log('BVT_ORDER_PROCESSOR',TO_CHAR(SYSDATE,'HH24:MI:SS')||' '||p_text);
UTL_FILE.PUT_LINE(p_filehandle, p_text);
END writeLog;
/** Procedure to output text to a file.
* @param p_filehandle The pointer / handle to the output file
* @param p_process_name The process name to be used as part of the filename
* @param p_footer The text to output at the end of the file
*/
PROCEDURE Close_Log(p_filehandle UTL_FILE.FILE_TYPE,
p_process_name IN VARCHAR2,
p_footer IN VARCHAR2 DEFAULT 'Y') IS
l_dummy VARCHAR2(5);
BEGIN
UTL_FILE.NEW_LINE(p_filehandle);
IF (p_footer = 'Y') THEN
UTL_FILE.PUT_LINE(p_filehandle, 'Log Ended on : '||TO_CHAR(SYSDATE, 'DD-MON-YYYY HH24:MI:SS'));
END IF;
g_filehandle:=p_filehandle;
UTL_FILE.FCLOSE(g_filehandle);
EXCEPTION
WHEN OTHERS THEN
NULL;
END;
/** Procedure to output text to a file.
* @param in_file The pointer / handle to the output file
* @param in_text The text to output to the file
*/
PROCEDURE writeLine(in_file UTL_FILE.FILE_TYPE,in_text VARCHAR2)
AS
BEGIN
UTL_FILE.PUT_LINE(in_file,in_text);
END writeLine;
/** Procedure to create a coremetrics data file in CSV format for all locales of a store.
* There may be multiple locales for a store. In this case the date is output for each locale in turn.
* @param p_logPath The path for creating the file
* @param in_locale The store to create the file for.
* @param in_client_id The id used to identify the file
*/
PROCEDURE createCDFFile(p_logPath IN VARCHAR2,in_locale VARCHAR2,in_client_id NUMBER) AS
-- locale variables
v_filehandle UTL_FILE.FILE_TYPE;
v_dataRecord max_vc2;
v_outputFileName VARCHAR2(26);
v_outputFile UTL_FILE.FILE_TYPE;
v_RecordCount NUMBER;
v_store_id NUMBER;
BEGIN
-- Initialise log files
v_filehandle:=init(p_logPath,g_logName);
writelog(v_filehandle,'Beginning cdf file extract for locale: ' || in_locale);
v_RecordCount := 0;
-- Open data file and output detalls to log.
v_outputFileName := in_client_id|| '.csv';
v_outputFile := UTL_FILE.FOPEN('/u01/hausers/eitctran/data', v_outputFileName, 'w', 32000);
writelog(v_filehandle,'Files opened');
writelog(v_filehandle,'Getting locales for store ' || in_locale || ' ...');
-- Get store id for the locale and then retrieve all locales for this store.
v_store_id:=Ecc_utils.get_store_id(upper(in_locale));
SELECT DISTINCT (value)
BULK COLLECT INTO pltab_locale
FROM ITC_CONTROL
WHERE store_id = v_store_id
AND usage = 'STORE_CONFIG_CUSTOMER';
-- Get Category data.
writelog(v_filehandle,'Selecting categories ...');
SELECT in_client_id, ctp_class_id, '"' || replace(name, '"', '') || '"', parent_ctp_class_id
BULK COLLECT INTO pltab_client_id, pltab_ctp_class_id, pltab_name, pltab_parent_ctp_class_id
FROM bv_category
START WITH store_id=v_store_id
AND parent_oid =0
AND content_type=0
CONNECT BY PRIOR oid=parent_oid;
writelog(v_filehandle,SQL%ROWCOUNT ||' categories selected');
writelog(v_filehandle,'Creating file cdf file '|| in_client_id || '.csv');
-- For each locale, output all the category details retrieved.
FOR v_count2 IN 1..pltab_locale.COUNT LOOP
writelog(v_filehandle,'Outputing Records for locale ' || pltab_locale(v_count2));
FOR v_count IN 1 .. pltab_ctp_class_id.COUNT LOOP
-- If the record is the top category record then do not output the parent category_id.
v_dataRecord := NULL;
IF (v_count = 1) THEN
v_dataRecord := v_dataRecord || pltab_client_id(v_count) || ',';
v_dataRecord := v_dataRecord || pltab_locale(v_count2) || pltab_ctp_class_id(v_count) || ',';
v_dataRecord := v_dataRecord || pltab_name(v_count) || ',';
ELSE
v_dataRecord := v_dataRecord || pltab_client_id(v_count) || ',';
v_dataRecord := v_dataRecord || pltab_locale(v_count2) || pltab_ctp_class_id(v_count) || ',';
v_dataRecord := v_dataRecord || pltab_name(v_count) || ',';
v_dataRecord := v_dataRecord || pltab_locale(v_count2) || pltab_parent_ctp_class_id(v_count);
END IF;
writeLine(v_outputFile,v_dataRecord);
v_RecordCount := v_RecordCount + 1;
END LOOP;
END LOOP;
-- Close files.
UTL_FILE.FFLUSH(v_outputFile);
UTL_FILE.FCLOSE(v_outputFile);
writelog(v_filehandle,'Finished creating cdf file' );
writelog(v_filehandle,'Total records processed: '|| v_RecordCount);
close_log(v_filehandle,g_logName);
END createCDFFile;
END COREMETRICS;
/
Can anyone help !!!