如何通过sql plus从命令行发出单个命令? [英] How can I issue a single command from the command line through sql plus?

查看:143
本文介绍了如何通过sql plus从命令行发出单个命令?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用SQL Plus,您可以从命令行使用@运算符运行脚本,如:

Using SQL Plus, you can run a script with the "@" operator from the command line, as in:

c:\>sqlplus username/password@databasename @"c:\my_script.sql"

但是,是否可以使用类似的语法运行单个命令,而无需整个单独的脚本文件?如:

But is it possible to just run a single command with a similar syntax, without a whole separate script file? As in:

c:\>sqlplus username/password@databasename @execute some_procedure

我对此感兴趣,因为我想写一个简单执行命令的批处理文件,而不生成一串双行。 sql文件。

I am interested in this because I want to write a batch file that simply executes a command, without generating a bunch of two-line ".sql" files.

推荐答案

我可以运行一个SQL查询通过管道到SQL * Plus:

I'm able to run an SQL query by piping it to SQL*Plus:

@echo select count(*) from table; | sqlplus username/password@database

提供

@echo execute some_procedure | sqlplus username/password@databasename

一次。

这篇关于如何通过sql plus从命令行发出单个命令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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