Skip to Main Content
  • Questions
  • Diff BW Collection type and Object Type

Breadcrumb

XMAS_TREE

The AskTOM team is taking a break over the holiday season, so we're not taking questions or responding to comments. Please have a happy and safe festive season and as always, thanks for being a member of the AskTOM community.

Question and Answer

Connor McDonald

Thanks for the question.

Asked: November 17, 2016 - 9:33 am UTC

Last updated: May 23, 2017 - 1:25 am UTC

Version: 11g

Viewed 1000+ times

You Asked

Hi,

I am Oracle Beginner,Would you please explain the difference between Object type and Collection Type?

Thank you.

and Connor said...

An object type is a kind of data type. You can use it in the same ways that you use standard data types such as NUMBER or VARCHAR2.

Object types are composed of attributes and methods, eg

CREATE TYPE person_typ AS OBJECT (
  idno           NUMBER,
  first_name     VARCHAR2(20),
  last_name      VARCHAR2(25),
  email          VARCHAR2(25),
  phone          VARCHAR2(20),
  MAP MEMBER FUNCTION get_idno RETURN NUMBER, 
  MEMBER PROCEDURE display_details ( SELF IN OUT NOCOPY person_typ ));


Collection types are more like arrays, ie, one or more elements. Oracle Database supports two collection data types: varrays and nested tables


Rating

  (1 rating)

We're not taking comments currently, so please try again later if you want to add a comment.

Comments

A reader, May 21, 2017 - 5:20 am UTC

"Oracle Database supports two collection data types: varrays and nested tables"
Then Associative Array?

Connor McDonald
May 23, 2017 - 1:25 am UTC

Semantics here. In terms of "SQL types" it is nested and varray.

In terms of additional types supported by PLSQL, than associative arrays as well.

12.2 blurs things more by increased support for plsql types via SQL.

More to Explore

PL/SQL demos

Check out more PL/SQL tutorials on our LiveSQL tool.

PL/SQL docs

PL/SQL reference manual from the Oracle documentation library