In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly shows you "what is the use of package header and package body package in oracle", the content is simple and clear, and I hope it can help you solve your doubts. Let me lead you to study and learn this article "what is the use of package header and package body package in oracle".
Program package
1 the function is to modularize the real program.
2 the package can contain PL/SQL programs such as stored procedures, functions, variables, cursors, etc.
3 the package is similar to the jar package of java, stored procedures, functions, variables, cursors and other methods provided by the jar package.
4 when calling the stored procedures, functions and other elements in the package, oracle will call the package into memory, and the next time you use it, read it directly from memory.
Then these projects are private projects and can only be used in packages.
The composition of a packet
Package: the header part declares the data types, constants, variables, cursors, subroutines, and exception error handling in the package, which are the public elements of the package.
Package body (package body): the package body is the concrete implementation of the package definition part, which is responsible for providing a specific implementation for the declared subroutines in the package header, and can also declare the private elements of the package in the package body.
The header and the body of the package are compiled separately and stored in the database dictionary as two separate objects.
Grammatical rules of the second package
The syntax of Baotou is as follows:
Create or replace package package name
As | IS
Procedure procedure name ()
Function function name () return data type
Variable definition
Exception definition
Cursor definition
.
.
End package name
Syntax for package creation:
Create or replace Package Body package name
As | IS
Procedure process definition
Procedure process definition
Function function definition
Function function definition
.
End package name
The development steps of the package
Like the development stored procedure, the development of a package requires several steps:
1. Adjust each stored procedure correctly
2. Integrate each stored procedure and function with text editing software
3. Add the package definition to the front of the integrated text as required by the package definition
4. Add the package body in front of the integrated text as required by the definition of the package
5. Use SQLPLUS or development tools to modulate.
Encryption utility
ORACLE provides a utility to encrypt or wrap a user's PL/SQL, which changes the user's PL/SQL to a version of the code that only ORACLE can interpret.
The WRAP utility is located at $ORACLE_HOME/BIN.
The format is:
WRAP INAME= [ONAME=]
Wrap iname=e:\ sample.txt
Note: before encrypting, please save a copy of PL/SQL program for later use.
Unwanted packages can be deleted using the DROP PACKAGE command, with the following syntax:
DROP PACKAGE [BODY] [user.] package_name
Packages, like procedures and functions, are also stored in the database, and their source code can be viewed at any time. If necessary, you can view more detailed compilation errors at any time when you create the package. Unwanted packages can also be deleted.
Similarly, to avoid call failures, be sure to recompile packages that depend on it after updating the structure of the table. After updating the package description or package body, you should also recompile the package description and package body. The syntax is as follows:
ALTER PACKAGE package_name COMPILE [PACKAGE | BODY | SPECIFICATION]
You can also view the correlation of packages through the following data dictionary view.
DBA_SOURCE, USER_SOURCE, USER_ERRORS,DBA-OBJECTS
For example, we can use: select text from user_source wherename='DEMO_PKG1'; to view the source code of the package we created.
The above is all the content of the article "what is the use of package header and package body package in oracle". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
SQL > @ awrsqrpt.sqlCurrent Instance~DB Id DB Name Inst Num Instance--
© 2024 shulou.com SLNews company. All rights reserved.