Bulk copy to text file in Oracle

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • manoop
    New Member
    • Oct 2007
    • 3

    Bulk copy to text file in Oracle

    Hi friends

    How to bulk copy the output of a query to textfile in PL/SQL


    Thanks

    Manoop
  • amitpatel66
    Recognized Expert Top Contributor
    • Mar 2007
    • 2358

    #2
    Originally posted by manoop
    Hi friends

    How to bulk copy the output of a query to textfile in PL/SQL


    Thanks

    Manoop
    You can make use of UTL_FILE package for writing data to text file using PLSQL.

    Comment

    • manoop
      New Member
      • Oct 2007
      • 3

      #3
      Originally posted by amitpatel66
      You can make use of UTL_FILE package for writing data to text file using PLSQL.

      We want the output in a comma seperated format.

      Comment

      • debasisdas
        Recognized Expert Expert
        • Dec 2006
        • 8119

        #4
        Originally posted by manoop
        We want the output in a comma seperated format.
        then try to use the SPOOL command.

        Comment

        • amitpatel66
          Recognized Expert Top Contributor
          • Mar 2007
          • 2358

          #5
          Originally posted by amitpatel66
          You can make use of UTL_FILE package for writing data to text file using PLSQL.
          You can also try this:

          Have a cursor that selects the data from the table in the format:
          CURSOR C1 IS SELECT empno||','||ena me from emp;
          LOOP through the cursor and write the data using UTL_FILE record by record.

          or

          Use SPOOL command as suggested in above post

          Comment

          Working...