1.dos 下清屏 clear scr
一、PL_SQL变量定义
1.Scalar 标量-最简单的变量使用最刚
2.Composite 复合型变量-
3.Reference 引用变量
4.LOB 大变量音频,视频等
5.Bind variables 不是PL_SQL变量是环境变量
二、注意事项
1.每一行定义一个变量,注意缩进;
2.避免定义与列名相同的变量;
三、Scalar变量
1.Hold a single value
2.Have no internal components
四、%TYPE Attibute
1.Is used to declare a variable according to :
- A database column definition
- Another declared variable
2.Is prefixed with( prefixe 前缀 )
- The database table and column
- The name of the declared variable
3.语法
indetifier table.column_name % TYPE;
4.example
min_balance balance%type := 1000;
五、Declaring Boolean Variables (boolean 型变量)
only the true、false、and null values can be assigened to a boolean variable;
六、Bind Variables(绑定变量)
1.Created in the environment;
2.Also called host variables;
3.EXAMPLE
variable b_emp_salary number;
begin
select salary into :b_emp_salary from employees where employee_id = 179;
end;
/
print b_emp_salary;
select first_name ,last_name from employees where salary=:b_emp_salary;