Five methods for Oracle 11g to call related functions

Source: Internet
Author: User

The following articles mainly introduce the five methods for Oracle 11g to call related functions, this article mainly uses Code related to its actual application to introduce how Oracle 11g calls the relevant functions. The following is an analysis of the specific content of this article.

1. This function accepts three optional parameters and returns the sum of three numbers.

 
 
  1. CREATE OR REPLACE FUNCTION add_three_numbers  
  2. (  
  3. a NUMBER:=0, b NUMBER:=0, c NUMBER:=0 
  4. )  
  5. RETURN NUMBER IS  
  6. BEGIN  
  7. RETURN a+b+c;  
  8. END;  

Call FUNCTION add_three_numbers

1. Call functions using location notation

 
 
  1. BEGIN  
  2. dbms_output.put_line(add_three_numbers(2,4,5));  
  3. END;  

2. Call a function using the naming notation

 
 
  1. BEGIN  
  2. dbms_output.put_line(add_three_numbers(b=>3, a=>4,c=>2));  
  3. END;  

3. Call a function by using location representation and naming notation.

 
 
  1. BEGIN  
  2. dbms_output.put_line(add_three_numbers(3, b=>4,c=>2));  
  3. END;  

4. Exclusion notation

 
 
  1. BEGIN  
  2. dbms_output.put_line(add_three_numbers(12,c=>2));  
  3. END;  

5. SQL call notation-hybrid notation

 
 
  1. SELECT add_three_numbers(3, b=>4,c=>2) FROM DUAL;  

The above content is a description of the five methods for Oracle 11g to call functions. I hope it will help you in this regard.

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.