Đang chuẩn bị liên kết để tải về tài liệu:
Oracle Built−in Packages- P99
Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Oracle Built−in Packages- P99: 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 BEGIN IF v IS NULL THEN DBMS_UTILITY.DB_VERSION v c END IF END FUNCTION version RETURN VARCHAR2 IS BEGIN init_info RETURN v END FUNCTION compatibility RETURN VARCHAR2 IS BEGIN init_info RETURN c END END Notice that this very simple package also optimizes lookups against the DBMS_UTILITY package. The first time you call either the DB.VERSION or the DB.COMPATILITY functions the private init_info procedure will detect that the v variable is NULL and so it will call the built-in procedure. From that point on however whenever you call either of the DB functions they will simply return the current value. After all the version of the database is not going to change during your connection to that database. Here is the output I received from db.version on Oracle8 SQL exec DBMS_UTILITY.PUT_LINE db.version 8.0.3.0.0 10.1.2.9 The DBMS_UTILITY.EXEC_DDL_STATEMENT procedure Oracle has added a procedure to the DBMS_UTILITY package that allows you to execute a DDL statement easily. The header for this procedure follows PROCEDURE DBMS_UTILITY.EXEC_DDL_STATEMENT parse_string IN VARCHAR2 Here for example is all the code I need to write to create an index from within PL SQL BEGIN DBMS_UTILITY.EXEC_DDL_STATEMENT create index so_easy on emp hiredate mgr sal END You can also use the DBMS_SQL package to perform the same functionality. 10.1.2.10 The DBMS_UTILITY.FORMAT_CALL_STACK function This function formats and returns the current call stack. You can use this function to access the call stack in your program. The header for the function follows FUNCTION DBMS_UTILITY.FORMAT_CALL_STACK RETURN VARCHAR2 10.1.2 The DBMS_UTILITY Interface 481 Appendix A What s on the Companion Disk 10.1.2.10.1 Example I generated the information in this next example with the following statement DBMS_OUTPUT.PUT_LINE DBMS_UTILITY.FORMAT_CALL_STACK The code shows sample output from a call to FORMAT_CALL_STACK. ---- PL SQL Call Stack ----- object line object handle number .