Oracle object-oriented and set

Source: Internet
Author: User

Oracle object-oriented and set

This is a summary of my recent learning experience.

1. Oracle object-oriented

We all know that SQL is set-oriented, but it is undeniable that there are many places in oracle that reflect the object-oriented thinking. (This is also a sign that major languages share the same things)

Why is there a lot of Object-oriented Thinking in Oracle? For example, I think it is a cursor that can best be reflected. Of course, there is a package)

Begin
Declare
Cursor students
Is
Select sid, name, age, holobby from my_test;
Student students % rowtype;
Begin
For student in students loop
Dbms_output.put_line ('student ID: '| student. sid | 'student name:' | student. name | ';');
End loop;
End;
End;


-- Running result
Student ID: 76 Student name: joy;
Student ID: 77 Student name: joy;
Student ID: 78 Student name: joy;
Student ID: 79 Student name: joy;
Student ID: 80 Student name: joy;
Student ID: 81 Student name: joy;
Student ID: 82 student name: joy;
Student ID: 83 Student name: joy;
Student ID: 84 Student name: joy;
Student ID: 85 Student name: joy;
Student ID: 86 Student name: joy;
Student No.: 87 Student name: joy;
Student ID: 88 Student name: joy;
Student ID: 89 Student name: joy;
......

Does the for loop have the ability to catch up with foreach in C?

Student. What if sid has no target?

In addition, the package is also a very strong object-oriented guy, such as some of the most commonly used built-in functions such as dbms_output.put_line (). It is very popular with object-oriented classes and methods, but Oracle doesn't. Object-oriented is a kind of thinking model. Oracle may also learn some of this content during the constant update process, so that developers can use it more quickly and comfortably.

Next we will talk about Oracle's collection-oriented

Ii. Collection-oriented Oracle

SQL is set-oriented. I have written some things in the Oracle collection article (), which overwrites some of my own opinions on this.

Relational databases integrate business data according to a certain degree of consistency. SQL statements exist to better process the data, so they want to improve SQL efficiency, most of the time, You Need To Know How Oracle works. When running an SQL statement, what sequence does Oracle perform for data processing, this involves the interpretation plan and execution plan.

Oracle10g later adopted the overhead-based optimizer (CBO) to run a large number of execution plans through statistical data, of course, this is not necessarily the most efficient and stable.

Programming with a set of ideas, in order to reduce the reading of data blocks as much as possible, because the I/O cost is usually very efficient, in addition, the collection-oriented method can make SQL look more concise, clear, and elegant. However, this requires a process.

Finally, I used a sentence from someone else to end with a head-on: Everyone can write the code that the computer knows, but only a thoughtful programmer can write the program code that everyone can understand.

This article permanently updates the link address:

This article permanently updates the link address:

  • 1
  • 2
  • Next Page

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.