Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2004
    Location
    Liverpool, NY USA
    Posts
    2,509

    Question Unanswered: Dynamic Host command.

    This is a simple question, but I can't figure out how to do it and I have none of my manuals available. I have a pl/sql script (8.1.7) that is running on a unix machine and uses a flat file as input (using sqlldr). When I am done, I want to rename the file by appending the date and time. I could issue a host command using the following command

    host mv my_table.txt my_table.txt.040727_1040

    However, I need to have it dynamicly name the file. When you run the host command, it passes everything to the right of the host command to the OS. I could make a variable called string with the following command.

    string := 'mv my_table.txt my_table.txt.'||to_char(sysdate,'YYMMDD.HH24MI')

    But how do I have the host command use the value of string instead of trying to invoke the string process in unix?
    Bill
    You do not need a parachute to skydive. You only need a parachute to skydive twice.

  2. #2
    Join Date
    Apr 2004
    Posts
    246
    column ts new_value ts
    select to_char(sysdate,'YYMMDD.HH24MI') fname from dual;

    host mv my_table.txt my_table.txt.&ts
    Give a man a fish, you feed him for a day. Club him over the head with a fish, he'll leave you alone.

  3. #3
    Join Date
    Jun 2004
    Location
    Liverpool, NY USA
    Posts
    2,509
    I know that it had to be simple. Thank you very much, it works great!!!
    Bill
    You do not need a parachute to skydive. You only need a parachute to skydive twice.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •