Live ORACLE

if you are Oracle Developer ,than this Blog most likely will make you happy.

About my Blog

This Blog particularized for Oracle Developers ... you will see interesting Codes for SQL , PL/SQL as well as new ideas for Developer Suite and Client Tools that will help you in your professional life ... and I hope I reach for your satisfaction.

About Me

I'm Hany Freedom , 25 years old , I live in EL-Minia City in Egypt , I'm Moderator at ArabOUG.org the best Arabic Forum for ORACLE on the Net. if you interested to know more about me .... just Click Here.

Working With Object Types

DROP TYPE address_typ;

CREATE TYPE address_typ AS OBJECT
(street VARCHAR2(30),
city VARCHAR2(20),
state CHAR(2),
postal_code VARCHAR2(6)
);
/

DROP TYPE employee_typ;

CREATE TYPE employee_typ AS OBJECT
(employee_id NUMBER(6),
first_name VARCHAR2(20),
last_name VARCHAR2(25),
email VARCHAR2(25),
phone_number VARCHAR2(20),
hire_date DATE,
job_id VARCHAR2(10),
salary NUMBER(8,2),
commission_pct NUMBER(2,2),
manager_id NUMBER(6),
department_id NUMBER(4),
address ADDRESS_TYP,
MAP MEMBER FUNCTION get_idno RETURN NUMBER,
MEMBER PROCEDURE display_address(SELF IN OUT NOCOPY EMPLOYEE_TYP)
);
/

CREATE TYPE BODY employee_typ AS
MAP MEMBER FUNCTION Get_idno
RETURN NUMBER
IS
BEGIN
RETURN employee_id;
END;
MEMBER PROCEDURE Display_address
(SELF IN OUT NOCOPY EMPLOYEE_TYP)
IS
BEGIN
dbms_output.Put_line(first_name
||' '
||last_name);
dbms_output.Put_line(address.street);
dbms_output.Put_line(address.city
||', '
||address.state
||' '
||address.postal_code);
END;
END;
/


CREATE TABLE employee_tab OF employee_typ;


OUTPUT: ALL Feedback return without any Errors.
Share/Save/Bookmark

0 comments:

Post a Comment



Newer Posts Older Posts Home Page
 
http://www.dpriver.com/images/sqlpp-banner-2.png

Thanks for reading my Blog ... you Visitor Number :-