TAILIEUCHUNG - Oracle SQL Plus The Definitive Guide- P31

Oracle SQL Plus The Definitive Guide- P31: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_270 next page Page 270 to doing this. First set up some COLUMN commands with NEW_VALUE clauses. You need one of these COLUMN commands for each distinct value in your input string. In keeping with the example the following two commands could be used COLUMN owner_name NOPRINT COLUMN table name NOPRINT NEW_VALUE s_owner_name NEWVALUE stablename Next you need to execute a query that returns the results you want. In this case the query needs to return the owner name and table name as separate columns. Be sure to use column aliases to name these columns and be sure those aliases match the names used in the COLUMN commands. The following SELECT takes a string in the form owner. table and returns two separate values. If the owner is not specified the name of the current user is returned instead. SELECT DECODE INSTR 1 . 0 USER Default to current user. UPPER SUBSTR 1 1 INSTR 1 . -1 owner_name DECODE INSTR 1 . 0 UPPER 1 Only the table name was passed in. UPPER SUBSTR 1 INSTR 1 . 1 table_name FROM dual Once the query has been executed the substitution variables named in the COLUMN commands will hold the values returned by the SELECT. These substitution variables may now be used in the remainder of the script. The following is a rewrite of the previous SELECT using these variables SELECT SUM bytes FROM dba_extents WHERE segment_name s_table_name AND owner s_owner_name By using this technique you have one point of change that controls how the input is parsed. If there s a bug in your logic you only need to fix it in one place. The readability of your script is greatly increased too. Your scripts will also be more clearly understood by others and probably by yourself as well. Error Handling SQL Plus doesn t offer too much in the way of error handling. By default SQL Plus simply ignores errors and goes on to execute either the next command you type in or the next command in the script you are running. For interactive use this is good enough. If an .

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã 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.