Oracle object-oriented and set-oriented, oracle object-oriented

Source: Internet
Author: User

Oracle object-oriented and set-oriented, oracle object-oriented

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, Hober 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; -- run 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 ID: 87 Student name: joy; student ID: 8 8. 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 blog. Here I want to rewrite some of my 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, let's use a sentence from someone else to end with a head-on-head: Everyone can write code that computers Know, But only thoughtful programmers can write code that everyone can understand.

 

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.