比如说你的表叫做a declare cursor curTblColInfo is select column_name from user_tab_columns where table_name=upper('a'); intTblCount number; tmpTblColInfo varchar2(10); begin select count(*) into intTblCount from user_tab_columns where table_name=upper('a'); dbms_output.put_line('a表有' || intTblCount || '列'); dbms_output.put_line('a表列详细信息'); open curTblColInfo; loop fetch curTblColInfo into tmpTblColInfo; exit when curTblColInfo%notfound; dbms_output.put_line(tmpTblColInfo); end loop; close curTblColInfo; end;
TRY IT .. SELECT COUNT(1) -- INTO rowcountnum FROM ALL_TAB_COLUMNS WHERE OWNER = UPPER('schema_name') AND TABLE_NAME = UPPER('table_name');
select count(*) from user_tab_columns where tab_name='表名'手头没环境测试,表名和字段名不知道写的对不对 如果要看详细的列信息,就用select * 喽
declare
cursor curTblColInfo is select column_name from user_tab_columns where table_name=upper('a');
intTblCount number;
tmpTblColInfo varchar2(10);
begin
select count(*) into intTblCount from user_tab_columns where table_name=upper('a');
dbms_output.put_line('a表有' || intTblCount || '列');
dbms_output.put_line('a表列详细信息');
open curTblColInfo;
loop
fetch curTblColInfo into tmpTblColInfo;
exit when curTblColInfo%notfound;
dbms_output.put_line(tmpTblColInfo);
end loop;
close curTblColInfo;
end;
SELECT COUNT(1)
-- INTO rowcountnum
FROM ALL_TAB_COLUMNS
WHERE OWNER = UPPER('schema_name')
AND TABLE_NAME = UPPER('table_name');
from user_tab_columns
where tab_name='表名'手头没环境测试,表名和字段名不知道写的对不对
如果要看详细的列信息,就用select * 喽
table_name我写成了tab_name
用习惯TOAD之类的工具,对这种SQL就不熟悉了
我的意思是这样的。
desc tableName ---其返回的是一个结果集,我可以把其结果集再返回到一个表中么?
如果可以该怎么做的?如果存储过程返回的是多条记录 我可以把其记录返回到一个新表中么?记得我学的时候好象说是不可以的。不敢确定的。就问问各位高手咯。。
谢谢大家啊~!