常用: 赋值: [:=] 连接字符: [||] 输出: dbms_out.put_line(‘some text’); 1、应用变量赋值输出的案例如下: Declare x varchar2(10); --声明变量 begin x:='this is'; --冒号等号赋值 := dbms_output.put_line('x的值为'||x); --双竖线||可以连接不同的数据类型,输出 end; --注意后的又分号 / 2、SQLPLUS下面查看set的帮助命令 [? Set] 3、set serveroutput on size 10000 设置缓存、最大为1000000 4、行注释: -- 5、块注释 /* */ 6、案例2 ,练习连接变量 declare x varchar2(10):='this is'; y string(10):='value of y'; z varchar2(20); begin z:=x||y; --连接两个变量 dbms_output.put_line(z); --输出 end; / 7、案例3【IF ENDIF】,加上了if判断。 DECLARE a number; b varchar2(10); begin a:=2; if a=1 then b:='a'; elsif a=2 then --这里是elsif而不是elseif b:='b'; else b:='c'; end if; --endif不要忘记 dbms_output.put_line('b的值是'||b); end; --end后面的分号也至关重要,不要忘记 / 8、案例4 [CASE ENDCASE]的用法 declare a varchar2(10); b number; begin a:='a'; case --case开始 when a='a' then b:=1; --内嵌很多个when then 语句 when a='b' then b:=2; when a='c' then b:=3; else b:='others'; end case; --case结束,有分号 dbms_output.put_line('b的值是'||b); end; /