oracle定义变量

1 应用别的表的字段是用%type类型:

    g_dic_account  t_isdt_data_dictionary.dic_value%type; -- 系统用户
    g_dic_name    t_isdt_data_dictionary.dic_value%type; -- 系统名称
    G_countern     t_isdt_data_dictionary.dic_value%type; --邮件内容

2 直接定义:

3 


4 存储过程定义:
procedure ISDT_REGIST_SENDEMAIL
(P_USER_ID  in varchar2,p_msg OUT VARCHAR2is

    g_dic_account  t_isdt_data_dictionary.dic_value%type; -- 系统用户
    g_dic_name    t_isdt_data_dictionary.dic_value%type; -- 系统名称
    g_countern     t_isdt_data_dictionary.dic_value%type; --邮件内容
begin
    ----
end


------------------------------------------------------------------------------------
PL/SQL Developer Test script 3.0
19
-- Created on 2017/3/10 by WWX397311 
declare 
  -- Local variables here
  dd varchar2(32);
begin
 select max(t.task_id) 
    into dd
    from T_ISDT_VEHICLE_TASK_LAST t
    where t.car_num = '粤BBU661'
    and rownum = 1
    order by t.created_date desc;
    
    if dd is null then
      dbms_output.put_line('-------没有查询结果');
    else
      dbms_output.put_line('I way see it,he is upset guy''s values is=' || dd);
    end if; 
  
end;
0
0
搏击长空
原文地址:https://www.cnblogs.com/yitong/p/6644696.html