All language subtitles for [SubtitleTools.com] Object Types - Learning Oracle 12c [Video]

af Afrikaans
ak Akan
sq Albanian
am Amharic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
ceb Cebuano
chr Cherokee
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fr French
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranรฎ)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
fa Persian
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu

Original subtitles

In this lesson, we're going to take a look

at objects in the database.

Now, when we refer to an object or a database object,

we can be referring to tables, indexes, procedures, packages,

or the like.

But starting in version 8.0, Oracle

was attempting to leverage some of the recent excitement

over object-oriented technology and to apply this

to database objects.

The result is the object technology

that Oracle has in the database.

Now, this is not something that is very commonly used today.

Some might even say it was added more of a marketing idea

more than anything.

However, it is present in the database, it can be used,

and, indeed, companies do use it because it really

allows you to multidimensionalize data,

at least in a rudimentary way.

Now, Oracle has other products to do multidimensional data,

but if you're going to use the object-oriented methodology all

of the way, so to speak, then you

can create objects and object types and tables that

use those object types within the database.

So the first thing we want to do is create a type.

So we're using a create or replace type statement

to create a type called address_ot,

and the ot as being object type.

And then we use the keywords AS OBJECT,

and this refers to our ability to instantiate it,

in certain circumstances, and use it

in a more object-oriented way.

Basically what this type is is a complex or multidimensional

data type.

So we have data types, like VARCHAR2, NUMBER, and DATE,

those being scalar data types.

These would be more of a multi-scalar object type,

or multidimensional.

I think you'll see what I mean as we create it.

So we have a data type here that we're creating, an object type.

We have street address, city, date code, and ZIP.

And our type is created.

So of course, when we're creating a table,

we could create individual columns

for street, city, state, and ZIP.

But what we're doing here is we're

encapsulating all of those into a composite type, if you will,

of address_ot.

And we're creating it as an object

so it can be instantiated in that way.

So let's create a table with this type.

So this is a table emp_info for just employee information.

Now, notice what we've done here.

We've created a table with four columns, a first name,

last name, and birth date.

And these are all what we would consider normal or regular data

types.

But the address that we're putting in our employee

information is actually an object type.

So we're declaring this address to be of the type address_ot.

So how do we leverage this?

So let's use a simple anonymous block PL SQL.

We'll declare a local variable, lv_address.

So for lv_address, the local variable,

we're assigning it to use the address object type

and to pass these values into the object.

And they correspond to these four variables

inside the object.

I'm going to take this and move the assignment down here.

And here, we'll use for instantiation.

So we're declaring the lv_address variable

as being of data type address_ot.

Here, we assign a value to the variable.

And now we're going to insert into the table.

Now, notice, if we're going to insert into this table,

certainly we can insert a first name, a last name, and a birth

date.

But how are we going to insert an entire address

into this object type?

Well, we'll see the methodology here.

We simply say lv_address.

Now, this references this variable assignment here.

And these values go back to match our object type.

Create that table.

And run our statement.

Anonymous block completed.

And if we do a select count star from emp info, highlight it,

we notice that we have one row.

So let's do select star from emp info.

Now, notice what we have here, the first name, last name,

and birthdate that we inserted.

But for address, it has to make a reference

to the address_ot object type.

And to pull this out, we actually

need to do a little extra work.

We actually need to reference the object type using an alias.

So here, we have the emp_info table

that we reference with the ei alias,

and ei being the alias here.

We say address, meaning this column, and street.

And this pulls out the street that we

inserted using the object type.

So essentially, we've instantiated this to pull back

just the street information.

And that goes back to this part of the type.

We could also change this to city

and pull back city information, as well.

So again, you may not see this all that often,

but this is kind of a basic look at how object technology works

within an Oracle database.

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.