Get the App
SLTechnology News&Howtos  ›  Database  › 

How to use spool to generate file names with dates in sqlplus

Shulou Source: shulou.com Published: 2022-05-31 15:11:08 10月01日 Update

Xiaobian to share with you how to use spool in sqlplus to generate file names with dates, I hope you have something to gain after reading this article, let's discuss it together!

sqlplus uses spool to generate file names with dates

col spf new_value spf noprint

select 'd:'||to_char(sysdate,'yyyymmdd')||'.txt' spf from dual;

spo &spf

select * from dual;

spo off;[@more@]

--sqlplus uses spool to generate file names with dates

accept un prompt 'User name: '

accept pw prompt 'secret code: ' hide

accept db prompt 'database: '

connect &un/&pw@&db;

pause continue?

set feedback off

set pages 0

set lines 30000

set trims on

set trim on

set ver off

set heading off

set time off

set timing off

set autot off

set echo off

set show off

set term off

col spf new_value spf noprint

select 'd:'||to_char(sysdate,'yyyymmdd')||'.txt' spf from dual;

spo &spf

select * from dual;

spo off;

exit

After reading this article, I believe you have a certain understanding of "how to use spool to generate file names with dates" in sqlplus. If you want to know more about it, welcome to pay attention to the industry information channel. Thank you for reading!

Tags: File file name date generation article finished data database more user user name knowledge industry information information channel channel Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MySQL Shulou Technology OPPO Reno macOS Microsoft