Oracle Database Programming: Develop PL/SQL subprograms and packages

Source: Internet
Author: User

Oracle Database Programming: Develop PL/SQL subprograms and packages to develop PL/SQL subprograms and packages: subprograms: Compile rather than run at run time. Only calls can produce results. Subprograms are divided into store procedure and function, which are stored in the database directly and in the database. DML addition, deletion, and switching processes, computing functions. Process: no return value.

        create or replace procedure sp_test1         (p_num number, p_num1 out number, p_num2 in out number)         is

 

Function: there is only one return value. The data type must be supported by the data table.
     create or replace function func_test1         (p_num  number, p_num1 out number)         return number         is

 

Call: SQL call: all name (); command line call: exec name; Self call: Name; package:
Establish a package specification: only declarations are not implemented, which is equivalent to interfaces. Create or replace package pac_name is end pac_name; create a package body: create or replace package body pac_name is to implement the content end pac_name;

 

When calling a package, add the class name as the prefix (package name. component name): parameter type: in cannot be imported only (input parameters cannot be assigned values, and can be passed into Integer constants); out can only be input only (Integer constants cannot be used, but variables can only be passed, input parameters can be assigned values); in-out and inbound and outbound.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.