Create a spool file with different date time and random number naming convention

Create a spool file with different day time or random number naming convention

Spool in Data format

col spoolname new_value spoolname
select 'invoice_'||to_char(sysdate, 'yymmdd') spoolname from dual;
spool &spoolname
select sysdate from dual;
spool off

Spool in Datatime format

col spoolname new_value spoolname
select 'invoice_'||to_char(sysdate, 'yymmddhh24miss') spoolname from dual;
spool &spoolname
select sysdate from dual;
spool off

Spool file in random format

col Number_rand new_value Number_rand
select to_char(abs(DBMS_RANDOM.random)) Number_rand from dual;
spool &Number_rand
select sysdate from dual;
spool off

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.