代码改变世界

Warning: Function created with compilation errors.

  abce  阅读(3908)  评论(0编辑  收藏  举报
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
SQL> create or replace function
  2     remove_constants(p_query in varchar2) return varchar2
  as
  4     l_query         long;
  5     l_char          varchar2(1);
  6     l_in_quotes boolean default FLASE;
  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>

  

查看并解决:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
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
  as
  4     l_query         long;
  5     l_char          varchar2(1);
  6     l_in_quotes boolean default FALSE;
  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>

  

编辑推荐:
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
阅读排行:
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· .NET10 - 预览版1新功能体验(一)
历史上的今天:
2016-06-22 oracle调整表中列顺序
2015-06-22 Unplugging一个PDB
2015-06-22 使用已有PDB克隆PDB
2015-06-22 Oracle 12C -- 使用seed PDB创建新的pdb
点击右上角即可分享
微信分享提示