Oracle数据库PL-SQL编程基本格式

set serveroutput on;--打开服务器输出
--declare 声明变量;“:=”是赋值符号
declare v_width integer;
  v_height integer :=2;
  v_area integer := 6;
  v_name store.products.name%type;--name的数据类型和store用户products表name字段相同
begin
  v_width :=  v_area / v_height ;
  dbms_output.put_line(‘v_width =||v_width );--打印结果
--异常处理
  exception
    when zero_divide then
    dbms_output.put_line(‘division by 0’);
end;
/

猜你喜欢

转载自www.cnblogs.com/suhfj-825/p/12327848.html