【PL/SQL基础知识】结构
                        
                            时间:2021-07-01 10:21:17
                            帮助过:15人阅读
							                        
                     
                    
                    
                    
declare
--声明的变量、类型、游标
begin
--程序的执行部分(类似于java的main()方法)
exception
--针对begin块中出现的异常
---when ... then ....
end ;
 
2.打印输出 hello world
declare
--声明的变量、类型、游标
begin
--程序的执行部分(类似于java的main()方法)
dbms_output.put_line(‘hello world‘);
end ;
 
3,查询id为2的员工的工资
declare
v_sal varchar2(20);
begin
--程序的执行部分(类似于java的main()方法)
select salary into v_sal from employees where id = 2;
 
dbms_output.put_line(v_sal);
 
end ;
 
4.查询id为2的员工的工资和姓名
declare
v_sal number(10);
v_name varchar2(32);
begin
--程序的执行部分(类似于java的main()方法)
select salary,name into v_sal,v_name from employees where id = 2;
 
dbms_output.put_line(v_sal||‘,‘||v_name);
 
end ;【PL/SQL基础知识】结构
标签:except   tput   begin   har   查询   out   style   employees   int