DBAsupport.com Forums - Powered by vBulletin
Page 2 of 2 FirstFirst 12
Results 11 to 15 of 15

Thread: spool..truncate..procedure ????

  1. #11
    Join Date
    Dec 2000
    Posts
    43
    You cannot concatenate into the variable you DEFINE. Thats why it doesn't append your '.xls' to the filename. Try selecting into it:

    Select 'D:\...\cgbill'||&v_date||'.xls' into v_file_name from dual;

  2. #12
    Join Date
    Dec 2000
    Location
    Ljubljana, Slovenia
    Posts
    4,439
    Take a look at COLUMN command in SQL*Plus documentation.

    Any how, here is how you should set the filename:

    COLUMN fname_with_date NOPRINT NEW_VALUE file_str
    SELECT 'c:\temp\x'||to_char(sysdate,'mm-dd-yyy_hh24:mi')||'.txt' AS fname_with_date FROM dual;
    Then reference &file_str in SPOOL command.

    Let's see if it works in SQL*Plus:

    SQL> COLUMN fname_with_date NOPRINT NEW_VALUE file_str
    SQL> SELECT 'c:\temp\x'||to_char(sysdate,'mm-dd-yyyy_hh24:mi')||'.txt' AS fname_with_date FROM dual;

    SQL> SPOOL &file_str
    SQL> SELECT * FROM DUAL;

    D
    -
    X

    SQL> REM Let's see wher is it spooling to:
    SQL> SPOOL
    currently spooling to c:\temp\x01-08-2001_21:43.txt
    SQL> SPOOL OFF
    SQL>

    HTH,
    Jurij Modic
    ASCII a stupid question, get a stupid ANSI
    24 hours in a day .... 24 beer in a case .... coincidence?

  3. #13
    Just for the record.
    In Windows a file cannot contain ':'
    Ramon Caballero, DBA, rcaballe@yahoo.com

  4. #14
    Join Date
    Dec 2000
    Location
    Ljubljana, Slovenia
    Posts
    4,439
    You are correct, I was to lazy to check if the file was actually created in the c:\temp directory - I simply belive what SQL*Plus told me where it is spooling currently ;-(.

    Now I removed the ":" from the file name and actually checked the file - it was created properly.
    Jurij Modic
    ASCII a stupid question, get a stupid ANSI
    24 hours in a day .... 24 beer in a case .... coincidence?

  5. #15
    Join Date
    Nov 2000
    Posts
    198

    Talking

    Cooooooool,

    WHILE count_of_thanks <= OO LOOP
    dbms_output.put_Line('thanks a million dude');
    END LOOP

Posting Permissions

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


Click Here to Expand Forum to Full Width