{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

scan0014 - themselves We use special syntax CREATE TABLE...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: themselves; We use special syntax CREATE TABLE ... OF .._to create \ a_sgLE3}}9Q_1221§££_£§9l§1*_.3uch a table can be treated as a table (A?) \OVV;‘ of fields, OR as a table of objects; two distinct display patterns (6)x& result, depending on the SELECT used. The£e_i§_gg_nam§_£9£_the (77 :Eglumn_g§_objectsi_in this case, unlike objecteg3b.sql. NOTE: )szn.¥”‘ r10 DESC emped is also different for objecteg3b and objecteg3c ,::: ‘ cIISb In PIVJ "Y this is for education employees, more or less, not baseball employees can use DROP TYPE address_type ”ONLY IF" it is not part of an existing table, i.e. emped would have to be dropped first the '/‘ at the end of CREATE TYPE seems to be pretty darned necessary This extension of object.sql adds VARRAY and an instance method The method return type should evidently not mention a size. The method body is defined within PL/SQL. The file is address_type.body DROP TABLE emped3; DROP TABLE emped; DROP TYPE name_type3; DROP TYPE addressgtype3; DROP TYPE phones_type3; DROP TYPE t_emped; CREATE TYPE address#type3 AS OBJECT ( ); / street VARCHAR2(20), city VARCHAR2(14), state VARCHAR2(14), zip NUMBER(5). member function streetName3 return VARCHARz, pragma restrict_references(streetName3,WNDS) CREATE TYPE name_type3 AS OBJECT ( ); / / first VARCHAR2(10), middle VARCHAR2(10), last VARCHAR2(10), member function middleInit return VARCHARZ, pragma restrict;;gferences(middlelnit,WNDS) CREATE TYPE phonesitype3 AS VARRAY(5) OF CHAR(12); CREATE TYPE t_emped AS OBJECT ( / empno VARCHAR2(6), ename name_type3, addr address_type3, phones phones_type3); SHOW ERRORS ;¢%7CREATE TABLE emped3 OF t_emped; CREATE TABLE empgg? (empno VARCHAR2(6), —— ename name_type3, —— addr addressfitype3l —-phones phones_type3); ,, the insert statements now change INSERT INTO emped3 VALUES{t_emped('plO‘,namefitype3(‘john‘,'david',‘sloan'), addressmtype3(*110 elm street‘,'topeka‘,'kansas‘,76111), phones_type3('619—44379876',null,null) ) ); INSERT INTO emped3 VALUES§Laemped(‘p20‘,name_type3(null,null,'mcGraw'), ...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online