oracle sqlplus 缓存区,SQL/PLUS学习笔记之编辑缓冲区中的当前行命令

上次我们介绍了:SQL/PLUS学习笔记之SQL的自动提交功能,本次我们介绍SQL/PLUS学习笔记之编辑缓冲区中的当前行命令,接下来就让我们一起来了解一下这部分内容吧。

(1).change (enable you to change the current line)

首先用list命令变换当前行(或者直接输入行号,回车也可改变当前行):

SQL> l  --显示缓冲区中内容:

class="dp-xml">

select * from t1

where id>1

* and id<2--*号为默认的当前行

SQL>l 2  --list 2将当前行变为第二行,但是这并不影响list的当前行(注意)

2* where id>1

SQL>l

1  select *

2  from t1

3  where

4  id<90--现在想把第四行的90改成85

5* and id>80

SQL>l 4  --先改变当前行到第四行

4* id<90

SQL>c/90/85  --change命令的用法

4* id<100

SQL> l  --用list命令显示发现90已经变成了85,这是可以用slash或run运行该新的SQL语句

1  select *

2  from t1

3  where

4  id<85

5* and id>80

SQL>run

1  select *

2  from t1

3  where

4  id<85

5* and id>80

ID NAME

---------- ------

81 Testing

82 Testing

83 Testing

84 Testing

(2).append(追加)

首先用list命令变换当前行(或者直接输入行号,回车也可改变当前行):

1  select id,name

2  from t1

3  where

4  id<85--在后面添加andname='Oracle'

5* and id>80

SQL>4  --改变当前行

4* id<85

SQL>a  andname='Oracle'--注意这里a和and之间有两个空格,如果只有一个的话

4* id<85andname='Oracle'--85和and会挨在一起

SQL>l  --list显示文本已追加

1  select id,name

2  from t1

3  where

4  id<85andname='Oracle'

5* and id>80

SQL>/

ID NAME

---------- --------------------

83 Oracle

(3).input命令

在当前行后面插入一个新行(to insert a new line after the current line)

首先用list命令变换当前行(或者直接输入行号,回车也可改变当前行)

定位到你要插入新行,然后i + 要插入的文本:

(这个比较特殊)在第一行前面加一段注释/* this is a testing demo! */

SQL>0 /* this is a testing demo! */ --就在第一行前面加上了该注释

SQL>l

1  select id,name

2  from t1

3  where

4  id<85--在第四行的下面插入一个新行

5* and id>80

SQL>4  --先变换当前行为第四行

4* id<85

SQL>i --this is a demo!  --input + text(要插入的文本)

SQL>l

1  select id,name

2  from t1

3  where

4  id<85

5  --this is a demo!

6* and id>80

SQL>/

ID NAME

---------- --------------------

81 Testing

82 Testing

83 Oracle

84 Testing

SQL>5 --将当前行改为5,在其后加一行,添加新的查询条件andname='Oracle'

5* --this is a demo!

SQL>i andname='Oracle'--插入

SQL>l

1  select id,name

2  from t1

3  where

4  id<85

5  --this is a demo!

6  andname='Oracle'

7* and id>80

SQL>/

ID NAME

---------- --------------------

83 Oracle

(4).del删除行命令

a.del n  --删除第n行

b.del n m  --删除从n到m行

c.del n *  --删除从第n行到当前行

d.del n last  --删除第n行到最后一行

关于SQL/PLUS学习笔记之编辑缓冲区中的当前行命令的知识就介绍到这里了,希望本次的介绍能够对您有所帮助。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值