zoukankan      html  css  js  c++  java
  • Warning: Function created with compilation errors.

    SQL> create or replace function
      2     remove_constants(p_query in varchar2) return varchar2
      3  as
      4     l_query         long;
      5     l_char          varchar2(1);
      6     l_in_quotes boolean default FLASE;
      7  begin
      8     for i in 1..length(p_query) 
      9     loop
     10             l_char :=substr(p_query,i,1);
     11             if(l_char='''' and l_in_quotes)
     12             then
     13                     l_in_quotes := FALSE;
     14             elsif(l_char='''' and not l_in_quotes)
     15             then
     16                     l_in_quotes := TRUE;
     17                     l_query     := l_query || '''#';
     18             end if;
     19             if(not l_in_quotes)
     20             then
     21                     l_query := l_query || l_char;
     22             end if;
     23     end loop;
     24  
     25     l_query := translate(l_query,'0123456789','@@@@@@@@@@');
     26     for i in 0..8 
     27     loop
     28             l_query := replace(l_query,lpad('@',10-i,'@'),'@');
     29             l_query := replace(l_query, lpad(' ',10-i,' '),' ');
     30     end loop;
     31     return upper(l_query);
     32  end;
     33  /
    
    Warning: Function created with compilation errors.
    
    SQL>
    

      

    查看并解决:

    SQL> show errors
    Errors for FUNCTION REMOVE_CONSTANTS:
    
    LINE/COL ERROR
    -------- -----------------------------------------------------------------
    6/14     PL/SQL: Item ignored
    6/30     PLS-00201: identifier 'FLASE' must be declared  #这里看出写错单词了
    11/3     PL/SQL: Statement ignored
    11/22    PLS-00320: the declaration of the type of this expression is
             incomplete or malformed
    
    19/3     PL/SQL: Statement ignored
    19/10    PLS-00320: the declaration of the type of this expression is
             incomplete or malformed
    
    SQL> create or replace function
      2     remove_constants(p_query in varchar2) return varchar2
      3  as
      4     l_query         long;
      5     l_char          varchar2(1);
      6     l_in_quotes boolean default FALSE;
      7  begin
      8     for i in 1..length(p_query) 
      9     loop
     10             l_char :=substr(p_query,i,1);
     11             if(l_char='''' and l_in_quotes)
     12             then
     13                     l_in_quotes := FALSE;
     14             elsif(l_char='''' and not l_in_quotes)
     15             then
     16                     l_in_quotes := TRUE;
     17                     l_query     := l_query || '''#';
     18             end if;
     19             if(not l_in_quotes)
     20             then
     21                     l_query := l_query || l_char;
     22             end if;
     23     end loop;
     24  
     25     l_query := translate(l_query,'0123456789','@@@@@@@@@@');
     26     for i in 0..8 
     27     loop
     28             l_query := replace(l_query,lpad('@',10-i,'@'),'@');
     29             l_query := replace(l_query, lpad(' ',10-i,' '),' ');
     30     end loop;
     31     return upper(l_query);
     32  end;
     33  /
    
    Function created.
    
    SQL> 
    

      

  • 相关阅读:
    ORA-12543: TNS:destination host unreachable
    Visual Studio 2008 连接云端 visualstudio.com
    将博客搬至CSDN
    Shiro 系列笔记(一)
    Centos 6.7 安装jdk
    Centos service启动失败原因--权限问题
    form表单提交的ajax形式
    slf4j与mybatis结合显示sql
    Docker 部署 redis教程,附带部分小建议,防止踩坑
    Android中的EditText默认时不弹出软键盘的方法
  • 原文地址:https://www.cnblogs.com/abclife/p/7067150.html
Copyright © 2011-2022 走看看