【发布时间】:2018-10-15 16:43:36
【问题描述】:
@echo off
set user_name=username
set password=
set sid=sid
@echo select distinct scid, to_char(dlog_on_timestamp,'dd-Mon-YYYY hh:mi:ss') from table where dlog_on_timestamp > sysdate-7; | sqlplus -s %user_name%/%password%@%sid% >> C:\Users\test.txt
在运行这个批处理文件时,> 符号创建了文件 sysdate-7。但我需要运行数据库查询,结果应该存储在 test.txt
【问题讨论】:
标签: sql oracle batch-file sqlplus