In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
sqlplus Edit Command Line Usage
Keywords: oracle sqlplus command line usage
Oracle database has many query tools, such as the famous PLSQL, used to graphical interface, then face the character interface sqlplus is really a torture, but I do not know that immortal said "existence is reasonable."
Sometimes it is necessary to work in a character interface environment, such as customer site, Unix, Linux, AIX operating systems, etc. This article discusses some simple editing commands in sqlplus.
1, landing database
sqlplus username/password [@ instance name]
For example: sqlplus test/test@orac
Note: 1. Instance name is the definition of your oracle_sid macro. Note that there is no space between password and instance.
2. Disconnect the database
sql
< disconnect 3、更改数据库连接用户 sql < connect system/oracle@orac 4、设置行大小,页大小 sql < set linesize 200 sql < set pagesize 10 5、执行脚本,"/" "r" ";" 皆可 sql < select count(*) from order sql < / 6、列出上一脚本,l SQL>l
1 select * from order
2* where num='8888'
1, 2 for row number, * for current row
7, switch the line number, directly enter the number of lines can be
SQL> 1
1* select * from order
8, delete the row, del n, n represents the number of rows
SQL> l
1 select * from order
2* where num='8888'
SQL> del 2
SQL> l
1* select * from order
9. Add rows, i Insert new rows after active rows Paste, a Paste after current rows
SQL> l
1* select * from order
SQL> i where num='1021'
SQL> l
1 select * from order
2* where num='1021'
SQL> a tableb
1* select * from order tableb
* Note that at least two spaces must be empty after a, otherwise the operatortableb effect may occur.
10. Modify content c\Original content\New content
SQL> c \tableb\tablea
1* select * from order tablea
To sum up:
l --column sql
n --Switch active rows (n stands for row number)
a --add after active line (append)
i --insert new row after active row (put)
c --replace (change)
del n --delete row n
/ --execute sql
11. Set default editor
The above says some basic syntax in sqlplus, of course, if you are used to using vi, you can set the default editor to vi, as follows:
SQL> set _EDITOR=vi
SQL> ed
Type ed, sqlplus automatically switches to vi, modify sql in vi, save, will automatically re-read into sqlplus buffer (similar to sybase isql directly type vi).
You can also save editor settings to a configuration file and use that configuration automatically each time;
Modify the $ORACLE_HOME/sqlplus/admin/glogin.sql configuration file and add define _editor=vi. sqlplus will read the glogin.sql script when it starts.
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.