• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2851
  • Last Modified:

SQLplus | spool without file extension

Our enterprise system will only import files without a extension... Is there a way to SPOOL from sqlplus without a extension? I know how to change the extension and I know if none is specified it addes .LST but how can I just spool a filename like "myfile"? Thanks!
2 Solutions

4.2.2 Running Operating System Commands from SQL*Plus
Using the HOST command or an exclamation point (!) as the first character after the SQL*Plus prompt causes subsequent characters to be passed to a subshell. The SHELL environment variable sets the shell used to run operating system commands. The default shell is the Bourne shell. If the shell cannot be run, then SQL*Plus displays an error message.

To return to SQL*Plus, run the exit command or press Ctrl+d.

For example, to run a single command, use the following command syntax:

SQL> ! command

Why not try using a HOST command within the SQL*Plus script and rename the file after the spool off command but before exiting the script?
slightwv (䄆 Netminder) Commented:
There was a trick many versions ago where you could just use 2 periods:  ex./ spool myfile..

I've been unable to get it to work with (Windows) so, it was either a 'feature' they fixed or a new 'bug' they've introduced.

I'll play a little and see if I can find a new trick.  Otherwise I was thinking of the host/rename method like robyncoffey suggested.
Why not set a job which polls the folder you spool to and just make the job rename the file?

This meets the extensionless requirement as well as enabling you to avoid doing it by hand over and over.

MuddyMojoAuthor Commented:
I split the points because slightwv answered my question about the extension and robyncoffey offered a efficient work around. Thank you both and I hope you feel the split was resonable.

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now