To:
 baojianjun(包子)
 上次的贴已经接了!!有3个小问题呢!!

解决方案 »

  1.   

    if UPPER(var_ITABB)='DO'  then 
    begin
        SELECT  top 1 var_KindVale= WZMAX  FROM WQ_EVGR_E WHERE SMTP=var_SMTP and ITABB=var_ITABB and  WQGRD= var_i; 
    end
    end if;oracle 怎么写??
      

  2.   

    --不好意思我一直沒有仔細的看
    --我起始隻是做一個大概的模式,最好是樓主自己去檢查錯誤並改正
    --那就最好了
    CREATE function F_GetITABB(VAR_TYPE in varchar2,VAR_FLAG in varchar2) --改动
    return varchar   --改动
    as 
       temp varchar2(4000);  --中间变量 --改动
    begin 
       temp := '';                                        --说明:if VAR_TYPE =1 then 
       select temp||rtrim(ltrim(ITABB))||',' into temp
       from  (
              select distinct itabb 
              from   WQ_EVGR_E
              where  itabb in 
                    (
                     select COLUMNS_CODE 
                     from   TB_APPRAISE_ITABB 
                     where  smtp='GB3838-2002' 
                     and    COLUMNS_VISIBLE='√' 
                     and    columns_code<>'TPHK'
                     and    FLAG=VAR_FLAG
                    )
             ) AA
       where rownum =1 ;  
    end if ;--水域类型未知道
       temp:=substr(temp,1,length(temp)-1);
    return temp; 
    end
      

  3.   

    1:
    select  right(temp,length(temp)-instr(temp,'!'))oracle 有没有right呢?? 怎么写????用外連接(+)
    外部联接"+"的用法   外部联接"+"按其在"="的左边或右边分左联接和右联接.若不带"+"运算符的表中的一个行不直接匹配于带"+"预算符的表中的任何行,则前者的行与后者中的一个空行相匹配并被返回.若二者均不带’+’,则二者中无法匹配的均被返回.利用外部联接"+",可以替代效率十分低下的 not in 运算,大大提高运行速度.例如,下面这条命令执行起来很慢 select a.empno from emp a where a.empno not in (select empno from emp1 where job=’SALE’);   倘若利用外部联接,改写命令如下: select a.empno from emp a ,emp1 b where a.empno=b.empno(+) and b.empno is null and b.job=’SALE’;   可以发现,运行速度明显提高.
    2:
        where rownum =1 ;
     oracle 表示什么意思?返回所查詢數據集的一條記錄
    3:
    set @temp=case @temp='' then @tem else left(@temp,len(@temp)-1) endoracle 怎么写呢??temp:=decode(temp,'',tem,substr(temp,1,length(temp)-1))
      

  4.   

    To: baojianjun(包子) 谢谢老大!接贴!!