select * from TABLE1;
selcet table from TABLE2:这句查出的是TABLE1;
请问,这两句可以合并吗?
selcet table from TABLE2:这句查出的是TABLE1;
请问,这两句可以合并吗?
解决方案 »
- oracle日期格式转换问题
- 从2个表里取数,2个表里的id和name要对应上,下面这样写对吗?
- 如何在触发器里写sql语句,得到用户更新的列名称
- user1中建的过程,在user2中执行,如何让它此时只处理user2中的数据
- 关于HIBERNATE查询时 “返回一个JAVA对象的”问题?
- 【求助】oracle10g导入dmp文件总是失败,彻底被打败了
- 不懂pl/sql规范,求一句sql,会的人很easy
- 请问有没有针对ORACLE8.1.7的事件探察器(类似SQL SERVER中SQL MONITOR)之类的工具?!
- 很怪的现象???
- 数据迁移-求老司机带带我
- 请教sql语句
- 求助一条模糊查询排序语句
将select table from table2传给一个变量,然后拼成一个SQL,用execute immediate 去执行
as
type cursor1_type IS REF CURSOR;
cursor1 cursor1_type;
tbname varchar2(20);
tbrowcount number;
sqlstr varchar2(100);
begin
open cursor1 for select table_name from user_tables;
loop
fetch cursor1 into tbname;
sqlstr := 'select count(*) from '||tbname;
dbms_output.put_line(sqlstr);
execute immediate sqlstr into tbrowcount;
dbms_output.put_line(tbname||' 记录数:'||tbrowcount);
exit when cursor1%notfound;
end loop;
close cursor1;
end;简单弄个例子,你参考一下。
begin
selcet table into V_ta from TABLE2 where rownum=1;
execute immediate 'select * from '||V_ta;
end;
用 execute immediate 动态执行语句select * from TABLE1;