sqlplus中单&与双&&的区别
2015-06-15 19:12
866 查看
在单&的情况中,每次执行sql,oracle都要提示用户输入值,然后执行,在双&中,只需用户输入一次值,以后的每次运行都会使用第一次输入的值
SQL> select * from employees where employee_id=&id;
输入 id 的值: 205
原值 1: select * from employees where employee_id=&id
新值 1: select * from employees where employee_id=205
EMPLOYEE_ID FIRST_NAME
----------- ----------------------------------------
LAST_NAME
--------------------------------------------------
EMAIL
--------------------------------------------------
PHONE_NUMBER HIRE_DATE JOB_ID
---------------------------------------- -------------- --------------------
SALARY COMMISSION_PCT MANAGER_ID DEPARTMENT_ID
---------- -------------- ---------- -------------
205 Shelley
Higgins
SHIGGINS
EMPLOYEE_ID FIRST_NAME
----------- ----------------------------------------
LAST_NAME
--------------------------------------------------
EMAIL
--------------------------------------------------
PHONE_NUMBER HIRE_DATE JOB_ID
---------------------------------------- -------------- --------------------
SALARY COMMISSION_PCT MANAGER_ID DEPARTMENT_ID
---------- -------------- ---------- -------------
515.123.8080 07-6月 -02 AC_MGR
12008 101 110
SQL> select * from employees where employee_id=&id;
输入 id 的值: 206
原值 1: select * from employees where employee_id=&id
新值 1: select * from employees where employee_id=206
EMPLOYEE_ID FIRST_NAME
----------- ----------------------------------------
LAST_NAME
--------------------------------------------------
EMAIL
--------------------------------------------------
PHONE_NUMBER HIRE_DATE JOB_ID
---------------------------------------- -------------- --------------------
SALARY COMMISSION_PCT MANAGER_ID DEPARTMENT_ID
---------- -------------- ---------- -------------
206 William
Gietz
WGIETZ
EMPLOYEE_ID FIRST_NAME
----------- ----------------------------------------
LAST_NAME
--------------------------------------------------
EMAIL
--------------------------------------------------
PHONE_NUMBER HIRE_DATE JOB_ID
---------------------------------------- -------------- --------------------
SALARY COMMISSION_PCT MANAGER_ID DEPARTMENT_ID
---------- -------------- ---------- -------------
515.123.8181 07-6月 -02 AC_ACCOUNT
8300 205 110
SQL> select * from employees where employee_id=&&id;
输入 id 的值: 207
原值 1: select * from employees where employee_id=&&id
新值 1: select * from employees where employee_id=207
未选定行
SQL> select * from employees where employee_id=&&id;
原值 1: select * from employees where employee_id=&&id
新值 1: select * from employees where employee_id=207
未选定行
SQL> select * from employees where employee_id=&&id;
原值 1: select * from employees where employee_id=&&id
新值 1: select * from employees where employee_id=207
未选定行
SQL>
SQL> select * from employees where employee_id=&id;
输入 id 的值: 205
原值 1: select * from employees where employee_id=&id
新值 1: select * from employees where employee_id=205
EMPLOYEE_ID FIRST_NAME
----------- ----------------------------------------
LAST_NAME
--------------------------------------------------
--------------------------------------------------
PHONE_NUMBER HIRE_DATE JOB_ID
---------------------------------------- -------------- --------------------
SALARY COMMISSION_PCT MANAGER_ID DEPARTMENT_ID
---------- -------------- ---------- -------------
205 Shelley
Higgins
SHIGGINS
EMPLOYEE_ID FIRST_NAME
----------- ----------------------------------------
LAST_NAME
--------------------------------------------------
--------------------------------------------------
PHONE_NUMBER HIRE_DATE JOB_ID
---------------------------------------- -------------- --------------------
SALARY COMMISSION_PCT MANAGER_ID DEPARTMENT_ID
---------- -------------- ---------- -------------
515.123.8080 07-6月 -02 AC_MGR
12008 101 110
SQL> select * from employees where employee_id=&id;
输入 id 的值: 206
原值 1: select * from employees where employee_id=&id
新值 1: select * from employees where employee_id=206
EMPLOYEE_ID FIRST_NAME
----------- ----------------------------------------
LAST_NAME
--------------------------------------------------
--------------------------------------------------
PHONE_NUMBER HIRE_DATE JOB_ID
---------------------------------------- -------------- --------------------
SALARY COMMISSION_PCT MANAGER_ID DEPARTMENT_ID
---------- -------------- ---------- -------------
206 William
Gietz
WGIETZ
EMPLOYEE_ID FIRST_NAME
----------- ----------------------------------------
LAST_NAME
--------------------------------------------------
--------------------------------------------------
PHONE_NUMBER HIRE_DATE JOB_ID
---------------------------------------- -------------- --------------------
SALARY COMMISSION_PCT MANAGER_ID DEPARTMENT_ID
---------- -------------- ---------- -------------
515.123.8181 07-6月 -02 AC_ACCOUNT
8300 205 110
SQL> select * from employees where employee_id=&&id;
输入 id 的值: 207
原值 1: select * from employees where employee_id=&&id
新值 1: select * from employees where employee_id=207
未选定行
SQL> select * from employees where employee_id=&&id;
原值 1: select * from employees where employee_id=&&id
新值 1: select * from employees where employee_id=207
未选定行
SQL> select * from employees where employee_id=&&id;
原值 1: select * from employees where employee_id=&&id
新值 1: select * from employees where employee_id=207
未选定行
SQL>
相关文章推荐
- Redis笔记
- mysql主从同步问题解决
- Percona Xtradb Mysql Cluster学习(by quqi99)
- mysql主从同步
- mysql 数据库to_days,str_to_date函数的使用
- Memcached雪崩和穿透
- Oracle创建表空间、创建用户以及授权
- ibatis sqlmap.xml 自动提示
- postgresql数据迁移
- 全备恢复案例
- 【MongoDB入门教程】
- 09-【MongoDB入门教程】使用mongo命令行进行数据聚合
- 08-【MongoDB入门教程】使用mongo命令行删除数据
- mysql常用命令
- mysql事件执行存储过程
- Oracle数据库之PL/SQL游标
- sqlite3自增key设定(创建自增字段)
- linux下,PHP操作redis及redis、php-redis的安装
- mysql 配置向导
- Oracle连接问题