declarecol_name varchar2(30) := 'name'; col_val varchar2(30);beginselect col_name into col_val from user where age between 18 and 25; drop table t2; end;
两处错误: 1、select col_name into col_val from user where age between 18 and 25; 由于你用一个变量去接收返回值,因此就限定了这条语句只能返回一个值,就是说18到25岁的用户只能有一个 2、drop table t2; 这个应该是execute immediate 'drop table t2';
declarecol_name varchar2(30) := 'name'; col_val varchar2(30);beginselect col_name into col_val from user where age between 18 and 25; execute immediate 'drop table t2'; end;
select col_name into col_val from user where age between 18 and 25; 如果这条语句返回多个值,你的程序还能用吗?
两处错误:
1、select col_name into col_val from user where age between 18 and 25;
由于你用一个变量去接收返回值,因此就限定了这条语句只能返回一个值,就是说18到25岁的用户只能有一个
2、drop table t2;
这个应该是execute immediate 'drop table t2';
select col_name into col_val from user where age between 18 and 25; 如果这条语句返回多个值,你的程序还能用吗?