Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7769231
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T16:06:27+00:00 2026-06-01T16:06:27+00:00

I wrote a procedure using UTL_FILE: CREATE OR REPLACE PROCEDURE UTL_CREATE_FILE ( output_file in

  • 0

I wrote a procedure using UTL_FILE:

CREATE OR REPLACE PROCEDURE UTL_CREATE_FILE 
(
       output_file in  UTL_FILE.file_type,
       log_file    in UTL_FILE.file_type,
       filename    in VARCHAR2 (64),
       ddate       in VARCHAR2 (19),
       sep         in NVARCHAR2 (3)

)


  IS

   BEGIN


           sep := Chr(9);
           ddate := TO_CHAR (SYSDATE, 'YYYYMMDD');
           filename := 'EXT' || ddate || '.dat';
           output_file := UTL_FILE.fopen ('C:/home/S/', filename, 'w', 32000);
           log_file := UTL_FILE.fopen ('C:/home/S/', 'WEEKLY.log', 'a', 32000);

           UTL_FILE.put_line (log_file, TO_CHAR (SYSDATE, 'DD-MM-YYYY HH24:MI:SS') || 'Started with file ' || filename);

   select 'HUGE SQL STATEMENT'|| sep || 'Anykey' as OUTLINE from DUAL;
          UTL_FILE.put_line (output_file, OUTLINE);
          UTL_FILE.fclose (output_file);
          UTL_FILE.put_line (log_file, TO_CHAR (SYSDATE, 'DD-MM-YYYY HH24:MI:SS') || 'Finished for file ' || filename);
          UTL_FILE.fclose (log_file);
  END;

But Toad returns Warning: compiled but with compilation errors.

Could anybody help me?

As a result I would like to receive a EXT.DAT (and logs) in C:/home/S/ directory. Thank you in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T16:06:28+00:00Added an answer on June 1, 2026 at 4:06 pm

    TOAD should give you the compilation errors – they are probably on a separate tab (it’s been a while since I used that particular IDE).

    However, it easy to spot one bloomer: we cannot assign values to parameters defined in IN mode. The purpose of such parameters is that the calling program assigns their values.

    However, in this case I think you need to assign ddate and filename, so you should move them out of the procedure’s signature and into its declaration section.

    sep I would keep as a parameter but give it a default value.

    Bear in mind that SQL limits us to 4000 characters in a column . So if ‘HUGE SQL STATEMENT’ exceeds 3993 characters your code will hurl a runtime error.


    If you’re making these sorts of errors you’re probably not up-to-speed with the intricacies of writing files from PL/SQL. I suggest you read this previous answer of mine and also this one regarding this topic.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

below is the stored proc I wrote: create or replace procedure test005 as begin
here's the stored procedure i wrote.In this proc p_subjectid is an array of numbers
I wrote two methods with a void type parameter: procedure Method1(const MyVar; size: cardinal);
I wrote this procedure in a site. it take a string as input parameter(user
I wrote a tsql procedure which inserts a string into a text file which
I wrote an app using webpy (webpy.org). Part of this web app is recurring
I was trying to implement Fermat's primality test in Scheme. I wrote a procedure
I have wrote a code that can read an excel 2007 file using Microsoft
How do you write a stored procedure using C# in SQLCLR? Currently I am
I wrote a small VBA procedure to test uploading and downloading of files as

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.