In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces how to call sqlplus in the Oracle program, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to know about it.
Through sqlplus, you can connect to the database to perform data or set operations according to user permissions, but you need to interoperate and return results. This article describes how to use sqlplus in a program.
Environmental preparation
Create a docker-style demo environment using a stripped-down version of Oracle
Here Document
Because sqlplus is the console way corresponding to the user's interactive input / output, and obviously requires predetermined input during program execution, you can consider using Here Document, for example, if you want to confirm the database version information through sqlplus.
# sqlplus system/liumiao123 EOFSQL*Plus: Release 11.2.0.2.0 Production on Sun Oct 21 11:06:42 2018Copyright (c) 1982, 2011, Oracle. All rights reserved.Connected to:Oracle Database 11g Express Edition Release 11.2.0.2.0-64bit ProductionSQL > BANNER----Oracle Database 11g Express Edition Release 11.2.0.2. 0-64bit ProductionPL/SQL Release 11.2.0.2.0-ProductionCORE 11.2.0.2.0 ProductionTNS for Linux: Version 11.2.0.2.0-ProductionNLSRTL Version 11.2.0.2.0-ProductionSQL > Disconnected from Oracle Database 11g Express Edition Release 11.2.0.2.0-64bit Production#
Note: note that $in v$version needs to be escaped
Create table
Next, use Here Document to call sqlplus to create a table
# sqlplus system/liumiao123 stuid number (4), > stuname varchar2 (50), > primary key (stuid) >) > desc student; > EOFSQL*Plus: Release 11.2.0.2.0 Production on Sun Oct 21 11:11:52 2018Copyright (c) 1982, 2011, Oracle. All rights reserved.Connected to:Oracle Database 11g Express Edition Release 11.2.0.2.0-64bit ProductionSQL > 2 345 Table created.SQL > Name Null? Type-STUID NOT NULL NUMBER (4) STUNAME VARCHAR2 (50) SQL > Disconnected from Oracle Database 11g Express Edition Release 11.2.0.2.0-64bit Production# Thank you for reading this article carefully I hope the article "how to call sqlplus in the Oracle program" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support and pay attention to the industry information channel. More related knowledge is waiting for you to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.