Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

Practical no 4 (Advance Database)

Execute queries using structured type in SQL

Ans. In order to define a custom structure type using oracle database

CREATE TYPE Person_Type AS OBJECT

(Person_title VARCHAR(10);

Person_first_name VARCHAR(10);

Person_last_name VARCHAR(10))NOT FINAL;

Such Structure type can be then used to create a table, that can hold all colums defined in Person_Type CREATE TABLE
Person_Table OF Person_Type;

Select Person_title, Person_first_name,Person_last_name from Person_Table;

Insert into Person_Table Values(‘Male’,’Omkar’,’Shinde’);

Custom Structure type Support inheritance,

Which means that one can create another type that inherits from previous

NOT FINAL must be included a in a base structure type to allow for creation of any other Subtype.

CREATE TYPE Student_Type UNDER Person_Type(Roll_no NUMBER(10));

CREATE TABLE Student_Table OF Student_Type;

insert into Student_Table values(‘Female’,’Meena’,’xyz’,1);

Select Person_title, Person_first_name, Person_Last_name, Roll_no from Student_Table);

You might also like