desc tbname
select * from col;可以对文件进行操作,使用dbms_file包,关于dbms_file包,查看oracle文档

解决方案 »

  1.   

    PL/SQL 3.3以上的版本中,UTL_FILE包允许用户通过PL/SQL读写操作系统文件。如下: 
    declare
    file_handle UTL_FILE.FILE_TYPE;
    begin
    file_handle := UTL_FILE.FOPEN('/tmp', '文件名', 'w');
    UTL_FILE.PUTF(file_handle, '写入的信息\n');
    UTL_FILE.FCLOSE(file_handle);
    exception
    WHEN utl_file.invalid_path THEN
    raise_application_error(-20000, 'ERROR: Invalid path for file or path not in INIT.ORA.');
    end; PutF()过程用来以指定格式把文本写入一个文件Put_Line()过程把一个指定的字符串写入文件并在文件中开始新的一行
      

  2.   

    select * from user_tab_columns;
      

  3.   

    The UTL_FILE package lets your PL/SQL programs read and write operating system (OS) text files. It provides a restricted version of standard OS stream file input/output (I/O). The file I/O capabilities are similar to those of the standard operating system stream file I/O (OPEN, GET, PUT, CLOSE), with some limitations. For example, call the FOPEN function to return a file handle, which you then use in subsequent calls to GET_LINE or PUT to perform stream I/O to a file. When you are done performing I/O on the file, call FCLOSE to complete any output and to free any resources associated with the file. 
    Subprogram  Description  
    FOPEN function  Opens a file for input or output with the default line size.  
     
    IS_OPEN function  Determines if a file handle refers to an open file.  
     
    FCLOSE procedure  Closes a file.  
     
    FCLOSE_ALL procedure  Closes all open file handles.  
     
    GET_LINE procedure  Reads a line of text from an open file.  
     
    PUT procedure  Writes a line to a file. This does not append a line terminator.  
     
    NEW_LINE procedure  Writes one or more OS-specific line terminators to a file.  
     
    PUT_LINE procedure  Writes a line to a file. This appends an OS-specific line terminator.  
     
    PUTF procedure  A PUT procedure with formatting.  
     
    FFLUSH procedure  Physically writes all pending output to a file.  
     
    FOPEN function  Opens a file with the maximum line size specified.  
     
      

  4.   

    是的,在表:user_tab_columns中select table_name,column_name,data_type from user_tab_columns
      

  5.   

    file_handle := UTL_FILE.FOPEN('c:\', 'createdsql.txt', 'w');
    出现目录路径无效的错误
    什么道理啊?
    谢谢大家
      

  6.   

    关闭数据库,在init.ora文件中增加一个参数utl_file_dir=c:\,
    然后再打开数据库,这是重新执行这个过程。