oracle的替代变量

来源:互联网 发布:小天才早教软件 编辑:程序博客网 时间:2024/05/22 11:44
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'



















原创粉丝点击