Avatar of sunhux
 asked on

Sql script to spool / save to a disk file (in YYYYMMDD.spl) a select output

I'm no sql scripting person & need an sql script to
print out (ie save to disk file) the list of dormant
users from our Oracle DB for last 30 days:

select * from ACTION_LOG where ACTION_DTTM >= trunc(sysdate-30)
  and ACTION_CD in ('SORAS') order by ACTION_DTTM DESC;

Will need someone to prefix it with
set spool ....   DormantAccts_YYYYMMDD.spl

to save output to a spool file which we'll email out
Oracle DatabaseScripting LanguagesSQL

Avatar of undefined
Last Comment

8/22/2022 - Mon

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
slightwv (䄆 Netminder)

johnsone's memory is much better than mine and he should get the points.

Small correction:  You need two periods when using a variable like that:
spool DormantAccts_&dt..spl

I've done it a few times.....
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.