1、 赋值:v_a := 1;
2、 循环: for x in (select ... from ...) loop begin ... end end loop;
3、 查询赋值:select a into v_a from ... ;
4、 统计条数:select (select count(*) from ...) into v_a from dual;
5、 判断语句: if(v_a is null) then ... elsif(v_a > 0 and v_a < 10) then ... elsif(v_a >0 or v_b is not null) then ... end if;
6、 获取错误信息: begin select a into v_a from ... ; exception when no_Data_found then v_a := ''; end;
7、 四舍五入小数:round(1.23456,3) = 1.234
8、 回车符:CHR(10)
9、 链接符:'a:'||v_a || CHR(10)||'b:'|| v_b
10、转换成字符型:to_char()
11、转换成数字型:to_number()
12、转换成日期型:to_date()
13、脚本调试打印:dbms_output.put_line()
14、脚本语言写法: declare v_a varchar2(64); begin ... exception when others then rollback; --记录脚本出错信息 ... end;