PL / SQL数据类型转换

时间:2015-03-31 05:04:31

标签: oracle plsql sqldatatypes

我正在编写PL / SQL过程,我遇到类型转换问题。这是我的代码:

create or replace FUNCTION fn_easy7 (att in nfl5.att%type, 
    comp in nfl5.comp%type, td in nfl5.td%type,inter in nfl5.inter%type, 
    yds_g in nfl5.yds_g%type, yds in nfl5.yds%type)
RETURN number IS
   a number;
   b number;
   c number;
   d number;
   e number;
BEGIN
   a :=  (((comp/att)*100)-30)/20;
   b := ((td/att)*100)/5;
   c := (9.5 - ((inter/att)*100))/4;
   d := ((TO_NUMBER(yds, '999')/att) - 3)/4 ;
   e := (a + b + c + d)/ 0.06;

   RETURN e;
END fn_easy7;

update nfl5
   set rate = fn_easy7(att , comp, td ,inter, yds_g, yds);

表格nfl5:

的说明
 Name      Null   Type         
---------- -----  ------------ 
  COMP            NUMBER(4)     
  YDS             VARCHAR2(8)  
  TD              NUMBER(3)    
  RATE            NUMBER       
  YDS_G           VARCHAR2(5)   

费率号码的类型。我有错误的数字或值错误。

0 个答案:

没有答案