写了下面的语句
1 declare
2 new_name user_source.name%type;
3 cursor cursor_1
4 is
5 select name from user_source;
6 begin
7 for myrecord in cursor_1 loop
8 dbms_output.put_line(myrecord.name);
9 drop procedure myrecord.name;
10 end loop;
11* end;
12 /运行出错,错误如下
drop procedure myrecord.name;
*
第 9 行出现错误:
ORA-06550: 第 9 行, 第 2 列:
PLS-00103: 出现符号 "DROP"在需要下列之一时:
begin case declare end
exit for goto if loop mod null pragma raise return select
update while with <an identifier>
<a double-quoted delimited-identifier> <a bind variable> <<
close current delete fetch lock insert open rollback
savepoint set sql execute commit forall merge pipe求高手解答
1 declare
2 new_name user_source.name%type;
3 cursor cursor_1
4 is
5 select name from user_source;
6 begin
7 for myrecord in cursor_1 loop
8 dbms_output.put_line(myrecord.name);
9 drop procedure myrecord.name;
10 end loop;
11* end;
12 /运行出错,错误如下
drop procedure myrecord.name;
*
第 9 行出现错误:
ORA-06550: 第 9 行, 第 2 列:
PLS-00103: 出现符号 "DROP"在需要下列之一时:
begin case declare end
exit for goto if loop mod null pragma raise return select
update while with <an identifier>
<a double-quoted delimited-identifier> <a bind variable> <<
close current delete fetch lock insert open rollback
savepoint set sql execute commit forall merge pipe求高手解答
解决方案 »
- Oracle提示the account is locked
- oracle coherence中间件 data grid有人了解吗?
- oracle 简单问题
- 有关一条SQL语句的问题?
- oracle10g 将xml文件 导入二维表
- 求问一sql语句问题!
- ORCALClE的列的缺省值是否可以设置为某个SEQUENCE
- SELECT * FROM NEWS WHERE (UpdateTime LIKE '%2005%') and (title like '%法%')这个语句怎么出了错?UpdateTime是日期类型的~
- 希望各位帮一下忙,关于字符转换的
- Oracle9i装不上呀!!!!急!!!
- latch:library cache影响数据库性能
- 数据库迁移问题
但一定要用有两种方法:动态SQL实现,DBMS_SQL
new_name user_source.name%type;
cursor cursor_1
is
select name from user_source;
begin
for myrecord in cursor_1 loop
dbms_output.put_line(myrecord.name);
execute immediate 'drop procedure '||myrecord.name;
end loop;
end;
new_name user_source.name%type;
CURSOR cursor_1 IS SELECT name FROM user_source;
BEGIN
FOR myrecord IN cursor_1 LOOP
dbms_output.put_line(myrecord.name);
-- 本地动态执行DDL
EXECUTE IMMEDIATE 'drop procedure '|| myrecord.name;
END LOOP;
END;