tailieunhanh - Oracle Built−in Packages- P99

Oracle Built−in Packages- P99: Ah, for the good old days of Version 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 , 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 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 or the 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 on Oracle8 SQL exec The 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 parse_string IN VARCHAR2 Here for example is all the code I need to write to create an index from within PL SQL BEGIN create index so_easy on emp hiredate mgr sal END You can also use the DBMS_SQL package to perform the same functionality. The 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 RETURN VARCHAR2 The DBMS_UTILITY Interface 481 Appendix A What s on the Companion Disk Example I generated the information in this next example with the following statement The code shows sample output from a call to FORMAT_CALL_STACK. ---- PL SQL Call Stack ----- object line object handle number .