Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use Oracle Package

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly explains the "use of Oracle Package", the content of the explanation is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "the use of Oracle Package" bar!

Preface

We may write a large number of stored procedures in the Oracle database when dealing with logic. because there is more data, it is more troublesome to find it. Using package can not only classify stored procedures, but also define common variables / types in package, which not only facilitates programming, but also reduces the compilation overhead of the server. Also, stored procedures for different package can be renamed.

The calling method of package

When we execute a stored procedure in a program or PL/SQL, we just enter the name of the stored procedure directly. If we add all the stored procedures to the package, we need to enter the package name when calling. Stored procedure name.

The creation of package

First open our PL/SQL and log in

Then click package with the right mouse button and pop up the menu and select New

Then we enter the name testpackage in both name and Purpose, and then click OK

After it is built, there will be two tabs on it: Baotou and Baobao.

Then we emptied the original package and defined a stored procedure test1 in the header.

Then write the stored procedure method of test1 in the package body, and after writing it, we compile it so that one of our packages is complete.

Let's refresh the Packages and we can see that our newly created package testpackage has been created. If we want to modify the editable package, we right-click to select the editing description and body directly, and we will go directly to our programming interface.

In the package, we can directly append the new stored procedure, or directly modify the original stored procedure.

Call the stored procedure of package

Going back to the package we just created, let's write a script for sql to call the stored procedure in the package.

After execution, let's take a look at the output to see the effect of the output.

It is completely in line with the method written in our stored procedure.

This is the end of Oracle package's approach.

Thank you for your reading, the above is the content of "the use of Oracle Package", after the study of this article, I believe you have a deeper understanding of the use of Oracle Package, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

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.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report