tailieunhanh - Oracle SQL Plus The Definitive Guide- P20

Oracle SQL Plus The Definitive Guide- P20:Every day, computer professionals the world over wake up, travel to the office, sit down in front of a computer, and begin another day working with that database called Oracle. Programmers write queries and stored procedures. Database administrators monitor performance, make database changes, and perform other maintenance tasks. Operations people may need to back up or recover a database. | previous page page_166 next page Page 166 You can then replace the filename in the SPOOL command with the substitution variable output_file. Here is the modified more user-friendly version of the extract script --This script extracts data from the employee --table and writes it to a text file in --a comma-delimited format. --Tell the user what he is about to do. PROMPT PROMPT This script creates a comma-delimited text file containing PROMPT employee data. All records from the employee table will PROMPT be output to this file. PROMPT --Give the user a chance to bail out. PAUSE Press ENTER to continue or ctrl-C to abort. --Ask the user for a filename. ACCEPT output_file CHAR PROMPT Enter the output filename --Set the linesize to accommodate the longest possible line. SET LINESIZE 136 --Turn off all page headings column headings etc. SET PAGESIZE 0 --Turn off feedback SET FEEDBACK OFF --Eliminate trailing blanks at the end of a line SET TRIMSPOOL ON SET TERMOUT OFF SPOOL imp output_file SELECT TO_CHAR employee_id employee_name II TO_CHAR employee_hire_date MM DD YYYY TO_CHAR employee_termination_date MM DD YYYY TO_CHAR employee_billing_rate FROM employee SPOOL OFF --Restore the default settings. SET LINESIZE 80 SET PAGESIZE 24 SET FEEDBACK ON SET TERMOUT ON previous page page_166 next page previous page page_167 next page Page 167 When you run this modified script it s much more obvious what is going to happen. In addition you have a chance to abort and you can specify whatever filename you like for the output. SQL @C EMPLOYEE_EXTRACT_FRIENDLY This script creates a comma-delimited text file containing employee data. All records from the employee table will be output to this file. Press ENTER to continue or ctrl-C to abort. Enter the output filename C A SQL Depending on your needs you could even go further and allow the user to enter some selection criteria in order to specify which employee records to extract. Reloading the Data Now that you know how to

TỪ KHÓA LIÊN QUAN
crossorigin="anonymous">
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.