这样的脚本比较难 
我们要从一个表,假如这个表是catalog从它找到table type 为"sys"的表, 
catalog 包括字段 table type 和table name 然后根据找出来的每个表,再把每一个表中数据都转化成为一个字符串: 
"insert into tablename values (.......)" 
并且写到一个文件中. 最后得到一系列insert into tablename values (.......)要求只能使用PL/SQL脚本,不能用其他工具(toad,pl/SQL developer等)

解决方案 »

  1.   

    select 'insert into '||tablename||' values (......);' from catalog where table_type = 'sys'
      

  2.   

    关键是values里面的值,必须要考虑到不同种类的数据类型,每个表的字段个数也不相同。就相当与把一个用户下面所有的表的所有数据全部转化为相应的Insert语句形式。
      

  3.   

    create procedure pro(p_table in varchar2)
    as
    cursor t_sor is
    select table_name,column_name from col where table_name=p_table;
    begin
    for v_sor in t_sor loop
    if v_sor.table_name=p_table then
    str:='insert into '||tablename||' values ('||c......);
    ...
    end if;
    end;
    /