当前位置:网站首页>Using sqlplus to operate database in shell script
Using sqlplus to operate database in shell script
2022-08-10 05:46:00 【DOCKER007】
Oracle client installation steps are shown in the blog post: CSDN
shell operation database tool script: https://download.csdn.net/upload/10975286
When operating the database in the shell script, you can use sqlplus
#Set database connection string
conn=user/[email protected]:1521/SID#define sql
sqlstr="select sysdate from dual;"#Execute sql and get the result
sql_exc=$( sqlplus $conn < $sqlstr commit; exit; EOF )#echo "sql execution result:"$sql_exc This method can get a lot of results, in addition to sql query results, there are also many version information and many other irrelevant characters, it is difficult to get the query results So modify it to the following code, which solves many problems of printing results, and only prints the results to be queried. #Set database connection string conn=user/[email protected]:1521/SID#define sql sqlstr="select sysdate from dual;"#Execute sql and get the result sql_exc=$( sqlplus -s /nolog < set echo off feedback off heading off underline off; conn $conn; $sqlstr commit; exit; EOF )#echo "sql execution result:"$sql_exc
边栏推荐
- 来亲自手搭一个ResNet18网络
- 小程序wx.request简单Promise封装
- pytorch框架学习(3)torch.nn.functional模块和nn.Module模块
- pytorch框架学习(9)torchvision.transform
- I use this recruit let the team to improve the development efficiency of 100%!
- 网络安全3
- error in ./node_modules/cesium/Source/ThirdParty/zip.js
- 基于Qiskit——《量子计算编程实战》读书笔记(四)
- 毫米波雷达基础概念学习
- ZigBee 网络设备相关内容
猜你喜欢
随机推荐
ResNet的基础:残差块的原理
使用Google Protobuf 在 Matlab 中工作
Module build failed TypeError this.getOptions is not a function报错解决方案
第二次实验
I use this recruit let the team to improve the development efficiency of 100%!
复杂的“元宇宙”,为您解读,链读APP即将上线!
Pony语言学习(九)——泛型与模式匹配(终章)
深度学习中数据到底要不要归一化?实测数据来说明!
树莓派入门(4)LED闪烁&呼吸灯
安装Robotics-toolbox-matlab, for 点云坐标系转换
error in ./node_modules/cesium/Source/ThirdParty/zip.js
Pony语言学习(八):引用能力(Reference Capabilities)
图纸怎么折?(A0,A1,A2,A3の图纸如何折成A4大小)
R绘制图像,图像特征提取
基于Qiskit——《量子计算编程实战》读书笔记(六)
基于Qiskit——《量子计算编程实战》读书笔记(七)
Knowledge Distillation Thesis Learning
链读好文:热加密存储与冷加密存储有什么区别?
三维点云分割
文章复现:SRCNN









