Oracle对象的用途有多广泛? [英] How widely used are Oracle objects?

查看:86
本文介绍了Oracle对象的用途有多广泛?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为数据库类编写一个作业,并且需要将现有的关系模式迁移到Oracle对象.整个崩溃让我感到纳闷,这些东西到底有多广泛使用?数据模型不灵通,语法令人恐惧,并且面向对象仅是实现方式的四分之三.

I'm writing an assignment for a databases class, and we're required to migrate our existing relational schema to Oracle objects. This whole debacle has got me wondering, just how widely used are these things? The data model is wonky, the syntax is horrendous, and the object orientation is only about three quarters of the way implemented.

有人真的使用吗?

推荐答案

对于初学者来说,一些标准的Oracle功能使用类型,例如XMLDB和Spatial(包括声明嵌套表数据类型的列).

For starters some standard Oracle functionality uses Types, for instance XMLDB and Spatial (which includes declaring columns of Nested Table data types).

此外,许多PL/SQL开发人员一直在使用类型来声明PL/SQL集合或流水线函数.

Also, many PL/SQL developers use types all the time, for declaring PL/SQL collections or pipelined functions.

但是我同意很少有地方广泛使用Types并以此构建PL/SQL API.造成这种情况的原因有很多.

But I agree few places use Types extensively and build PL/SQL APIs out of them. There are several reasons for this.

  1. Oracle实施Objects的速度非常慢.尽管它们是在8.0版中引入的,但直到9.2版,它们才完全支持继承,多态和用户定义的构造函数.没有这些功能,就不可能进行正确的面向对象编程.直到11g版本,我们才得到SUPER().即使到现在,也缺少一些功能,最显着的是TYPE BODY中的私有声明.
  2. 语法常常很笨拙或令人费解.该文档无济于事.
  3. 大多数与Oracle合作的人往往来自关系/程序设计学院.这意味着他们往往不了解OOP,或者他们不了解OOP在数据库编程中的有用之处.即使人们提出了一个巧妙的想法,他们仍然发现使用Oracle语法难以或不可能实施.
  1. Oracle has implemented Objects very slowly. Although they were introduced in version 8.0 it wasn't until 9.2 that they fully supported Inheritance, Polymorphism and user-defined constructors. Proper Object-Oriented Programming is impossible without those features. We didn't get SUPER() until version 11g. Even now there are features missing, most notably the private declarations in the TYPE BODY.
  2. The syntax is often clunky or frustratingly obscure. The documentation doesn't help.
  3. Most people working with Oracle tend to come from the relational/procedural school of programming. This means they tend not to understand OOP, or they fail to understand where it can be useful in database programming. Even when people do come up with a neat idea they find it hard or impossible to implement using Oracle's syntax.

最后一点是关键.我们可以学习新的语法,可以说服Oracle完成功能集,但是只有能够使用Types才值得.这意味着我们需要可以使用继承和多态性解决的问题.

That last point is the key one. We can learn new syntax, we can persuade Oracle to complete the feature set, but it is only worthwhile if we can come up with a use for Types. That means we need problems which can be solved using Inheritance and Polymorphism.

我在一个广泛使用类型的系统上工作.它是一个数据仓库系统,而数据加载子系统是根据Types构建的.基本原理很简单:

I have worked on one system which used types extensively. It was a data warehouse system, and the data loading sub-system was built out of Types. The underlying rationale was simple:

  • 我们需要为加载的每个表应用相同的业务规则模板,因此流程是通用的;
  • 每个表都有自己的投影,因此每个SQL语句都是唯一的.

Type实现很干净:泛型过程是在Type中定义的;每个表的实现都在Type中定义,该Type继承自该泛型Type.特定类型可以从元数据生成.几年前,我在UKOUG上就此主题进行过介绍,并且已经在我的博客中进行了详细介绍.

The Type implementation is clean: the generic process is defined in a Type; the implementation for each table is defined in a Type which inherits from that generic Type. The specific types can be generated from metadata. I presented on this topic at the UKOUG a few years ago, and I have written it up in more detail on my blog.Find out more.

顺便说一句,关系理论包括域的概念,域的概念是用户定义的数据类型,包括约束等.RDBMS的风格实际上并不支持域,但是Oracle的类型实现无疑是整个过程中的一步.

By the way, Relational Theory includes the concept of Domains, which are user-defined data-types, including constraints, etc. No flavour of RDBMS actually supports Domains but Oracle's Type Implementation is definitely a step along the way.

这篇关于Oracle对象的用途有多广泛?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆