您的位置:首页 > 数据库 > Oracle

oracle的替代变量

2013-06-28 14:02 197 查看
1.

select empno,ename,sal,job,deptno from emp

where deptno=&no

2.

对字符变量的处理

select ename,job from emp where job=&job;

输入的变量添加''

3.复用替代变量(&&)

select ename,job,&&v_col from emp

order by &v_col

4.取消定义的替代变量,重新赋值

undefine v_col

5.

复杂的表达式

select &co1,&col2 from &table_name

where &condition

order by &sorting

6.define替换变量

define v_job=CLERK

select ename,sal,job from emp where job='&v_job'

order by sal;

7.accept替代变量

(先举例:select ename,sal,job from emp where job=upper('&v_job') order by sal

8.如何使用accept命令的hide的选项

select ename,sal,job from emp where '&pwd'='MANAGER'
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: