当前位置:Gxlcms > 数据库问题 > PL/SQL基本操作

PL/SQL基本操作

时间:2021-07-01 10:21:17 帮助过:38人阅读

o_booking_flag char(10); begin -- Call the procedure destine_ticket(000000037, 20, E, 2, o_booking_flag); dbms_output.put_line(o_booking_flag); end;

2、存储过程

create or replace procedure destine_ticket(i_flightId     in char, --不需要些类型值
                                           i_LuggageLimit in number ,
                                           i_class_code in char ,
                                           i_seats in number,
                                           o_booking_flag out char 
                                           ) 
is
  v_temp integer;
  v_temp1 integer;
begin

    begin
       select 1 into v_temp from flight  t1 where t1.flightid=i_flightId and to_number(t1.estdeparturedatetime-sysdate)*24 >= 3;
    exception --异常捕获
    when no_data_found then
         v_temp:=0; --复制要写:=
    end;
  return; --退出存储过程
end destine_ticket;

 3、过程调用

declare
  o_booking_flag char(10);
begin
 
  -- Call the procedure
  destine_ticket(i_flightid =>000000037,
                 i_luggagelimit =>20,
                 i_class_code =>E,
                 i_seats =>2,
                 o_booking_flag =>o_booking_flag);
end;

 

PL/SQL基本操作

标签:EDA   style   sql   put   类型   退出   sys   异常捕获   bms   

人气教程排行