有没有一种方法可以自动输入sql脚本提示? [英] Is there a way to auto-input sql script prompts?

查看:109
本文介绍了有没有一种方法可以自动输入sql脚本提示?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含以下语句的sqlscript:

I have a sqlscript that contains statements like this:

prompt Enter 'html' for an HTML report, or 'text' for plain text
prompt  Defaults to 'html'

column report_type new_value report_type;
set heading off;
select 'Type Specified: ',lower(nvl('&&report_type','html')) report_type from dual;

因此,当我运行脚本时,它会提示我输入值.我想自动执行此脚本.如何传递给用于提示的脚本参数?我根本无法通过删除提示来修改脚本.

So when I run the script it prompts me to enter in values. I want to automate this script. How would I pass to the script parameters that are then used for the prompts? I cannot modify the script at all by removing the prompts.

我正在使用Windows Server 2008和Windows 7.

I am using Windows Server 2008 and Windows 7.

推荐答案

在Unix上,您可以在此处使用以下文件:

On Unix you can use here documents:

#>sqlplus un @script <<EOF
yourpassword
parameter#1
parameter#2
EOF

这篇关于有没有一种方法可以自动输入sql脚本提示?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆