Notes for writing functions in the Oracle package

Source: Internet
Author: User
I just started to use PLSQL to write something. It's still superficial. I don't want to be modest, but I want to know if some experts can see where they are wrong, hope to give me some advice. This afternoon I found my PLSQL package error and finally solved it... There are two small issues that cannot be solved. Let's share them with you. 1. In PL

At the beginning, I used PL/SQL to write something. It's still superficial. I don't want to be modest, but I want some experts to see where I am wrong, hope to give me some advice. This afternoon I found my own PL/SQL package error, and finally solved it... There are two small issues that cannot be solved. Let's share them with you. 1. In PL

At the beginning, I used PL/SQL to write something. It's still superficial. I don't want to be modest, but I want some experts to see where I am wrong, hope to give me some advice.

This afternoon I found my own PL/SQL package error, and finally solved it... There are two small issues that cannot be solved. Let's share them with you.

1. If it is a function in PL/SQL, it can be used in SQL statements, or in other PL/SQL program segments. However, you must pay attention to it when using it in the program segment. You must receive the return value of the function. Otherwise, PL/SQL considers this function as a process and returns an incorrect parameter type error.

For example, a function such as function add_two_num (num1 in number, num2 in number) return number must use num3: = add_two_num (num1, num2) even if you do not use the return value ); cannot Use add_two_num (num1, num2. Well, sometimes we use out-type variables, which may happen.

2. The variable name must be the same when defining the function and implementing the function in the package body in the header. Otherwise, the system will prompt that a function in the header is not defined, for example: define function add_two_num (num1 in number, num2 in number) return number in the header. in the package, you only implement function add_two_number (num3 in number, num2 in number ); it is not difficult to think that there are several methods to call functions in PL/SQL, and you will be very clear about this setting...

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.