ITPub博客

首页 > 数据库 > Oracle > pl/sql动态执行sql语句时报错:ORA-00911: 无效字符 ORA-06512: 在 line 14

pl/sql动态执行sql语句时报错:ORA-00911: 无效字符 ORA-06512: 在 line 14

原创 Oracle 作者:shuangoracle 时间:2010-08-27 10:25:23 0 删除 编辑

今天测试的时候遇到两个错误提醒,写下来给自己提个醒:
--建测试表
create table test_table(tablename varchar2(50),selectsql clob);
insert into test_table values('dual','select sysdate from dual;');
commit;

--pl/sql
SQL> declare
2 cursor c is select selectsql from test_table;
3 cur c%rowtype;
4 v_selectsql varchar2(30000);
5 v_date date;
6 begin
7 open c;
8 fetch c into cur;
9 if c%notfound then
10 return;
11 end if;
12 v_selectsql := cur.selectsql;
13 execute immediate v_selectsql into v_date;
14 dbms_output.put_line(v_date);
15 close c;
16 end;
17 /

ORA-00911: 无效字符
ORA-06512: 在 line 14

--修改测试表test_table中selectsql字段,将最后的 ‘;’ 去掉,再执行:
SQL> /

27-8月 -10

PL/SQL procedure successfully completed

[@more@]

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/24496749/viewspace-1037464/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2010-08-25

  • 博文量
    84
  • 访问量
    242684