Problem in writing file to %userprofile% [message #417721] |
Tue, 11 August 2009 04:50 |
jolly_makkar
Messages: 63 Registered: March 2008
|
Member |
|
|
Quote: | PROCEDURE CREATE_FLAT_FILE IS
-- DESCRIPTION
-- Simple procedure to write to a text fille from a form
-- NOTES
-- Call this procedure from the WHEN-BBUTTON-PRESSED trigger
-- REQUIREMENTS
-- Must have access to local drives
--
--=============================================================================
in_file TEXT_IO.FILE_TYPE;
linebuf VARCHAR2(80);
your_file VARCHAR2(50) := 'C:\TEMP\your_file.dat';
text_line VARCHAR2(400);
BEGIN
in_file := TEXT_IO.FOPEN(your_file, 'W');
GO_BLOCK('YOUR_DATA_BLOCK');
FIRST_RECORD;
LOOP
IF :your_checkbox = 'Y' THEN
text_line := LPAD(:your_item1, 10, ' ')||
LPAD(:your_item2, 20, ' ')||
LPAD(:your_item3, 30, ' ')||
LPAD(:your_item4, 50, ' ');
--
TEXT_IO.PUT_LINE(in_file, text_line);
END IF;
--
exit when :SYSTEM.LAST_RECORD = 'TRUE';
NEXT_RECORD;
END LOOP;
--
TEXT_IO.FCLOSE(in_file);
EXCEPTION
WHEN NO_DATA_FOUND THEN
TEXT_IO.FCLOSE(in_file);
END;
|
==============================================
Procedure is working fine ,but is it possible that i can write on %userprofile% path
i tried changing
Quote: | your_file VARCHAR2(50) := 'C:\TEMP\your_file.dat';
|
to
Quote: | your_file VARCHAR2(50) := '%USERPROFILE%\your_file.dat';
|
it raised an error .how i can write in %userprofile%
Your guidance would be worth.....
Regards
|
|
|
Re: Problem in writing file to %userprofile% [message #417854 is a reply to message #417721] |
Tue, 11 August 2009 19:35 |
|
djmartin
Messages: 10181 Registered: March 2005 Location: Surges Bay TAS Australia
|
Senior Member Account Moderator |
|
|
Please use 'code' tags for code as 'quote' tags are for making a quote!
Do you know of a command that when run at the windows 'cmd' prompt will resolve '%USERPROFILE%'? If so then use it in a 'host' command, direct the output to a file, and then read that file.
David
|
|
|