Đang chuẩn bị liên kết để tải về tài liệu:
Oracle Built−in Packages- P25
Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Oracle Built−in Packages- P25: Ah, for the good old days of Version 1.0 of PL /SQL! Life was so simple then. No stored procedures or functions and certainly no packages. You had your set of built−in functions, like SUBSTR and TO_DATE. You had the IF statement and various kinds of loops. With these tools at hand, you built your batch−processing scripts for execution in SQL*Plus, and you coded your triggers in SQL*Forms 3.0, and you went home at night content with a good day's work done. | Appendix A What s on the Companion Disk AND table_name table_in Using Dot Notation Notice that my cursor takes two parameters owner_in and table_in but that my program itself only accepts a single table name parameter. Rather than have the user pass this information in as two separate parameters she can use standard dot notation as in SCOTT.EMP and the intab procedure will parse them as follows dot_loc INSTR table_nm . IF dot_loc 0 THEN owner_nm SUBSTR table_nm 1 dot_loc-1 table_nm SUBSTR table_nm dot_loc 1 END IF You should always try to make the interface as seamless and intelligent as possible for your users. You should also always try to make use of existing programs to implement your own. In this case as pointed out to me by Dan Clamage a technical reviewer you can also use DBMS_UTILITY.NAME_TOKENIZE to parse this object name. With this column cursor I extract the name datatype and length information for each column in the table. How should I store all of this information in my PL SQL program To answer this question I need to think about how that data will be used. It turns out that I will use it in many ways for example I will use the column names to build the select list for the query. To display the output of a table in a readable fashion I need to provide a column header that shows the names of the columns over their data. These column names must be spaced out across the line of data in well columnar format. So I need the column name and the length of the data for that column. To fetch data into a dynamic cursor I need to establish the columns of the cursor with calls to DEFINE_COLUMN. For this I need the column datatype and length. To extract the data from the fetched row with COLUMN_VALUE I need to know the datatypes of each column as well as the number of columns. To display the data I must construct a string containing all the data using TO_CHAR to convert numbers and dates . Again I must pad out the data to fit under the column names just as I did .