Oracle tutorial : Object oriented programming in Oracle PL SQL

Oracle tutorial : Object oriented programming in Oracle PL SQL

oracle tutorial for beginners

This video Oracle tutorial will tell you how to implement object oriented concept in oracle

CREATE OR REPLACE TYPE MyInput AS object
(
num1 NUMBER,
num2 NUMBER
);

CREATE OR REPLACE TYPE MyCal AS object
(
mynum MyInput,

member FUNCTION Plus RETURN NUMBER ,
member FUNCTION Sub RETURN NUMBER,
member FUNCTION Mul RETURN NUMBER,
member FUNCTION Div RETURN NUMBER
);
/

CREATE OR REPLACE TYPE BODY MyCal as
member FUNCTION Plus RETURN NUMBER AS
result NUMBER ;
BEGIN
result := mynum.num1 + mynum.num2;
RETURN result;
END Plus ;

member FUNCTION Sub RETURN NUMBER AS
result NUMBER;
BEGIN
result := mynum.num2 – mynum.num1;
RETURN result;
END Sub;

member FUNCTION Mul RETURN NUMBER AS
result NUMBER ;
BEGIN
result := mynum.num1 * mynum.num2;
RETURN result;

END;

member FUNCTION Div RETURN NUMBER AS
result NUMBER (10, 3);
BEGIN
result := mynum.num1 / mynum.num2 ;
RETURN result;
END;

END ;
/

DECLARE
obj1 MyInput := MyInput(50, 100);
obj2 MyCal := MyCal(obj1);
BEGIN

Dbms_Output.Put_Line(obj2.Plus);
Dbms_Output.Put_Line(obj2.Sub);
Dbms_Output.Put_Line(obj2.Mul);
Dbms_Output.Put_Line(obj2.Div);
END;

#techquerypond

https://techquerypond.com

https://techquerypond.wordpress.com

https://twitter.com/techquerypond

Comments

Write a comment

*

Human Verification: In order to verify that you are a human and not a spam bot, please enter the answer into the following box below based on the instructions contained in the graphic.


Do you like our videos?
Do you want to see more like that?

Please click below to support us on Facebook!

Send this to a friend

▷ Other ReviewsVehicles▷ Show Cars▷ Motorbikes▷ Scooters▷ Rims & Tires▷ Luxury BoatsFashion▷ Sunglasses▷ Luxury Watches▷ Luxury Purses▷ Jeans Wear▷ High Heels▷ Perfumes▷ Jewellery▷ Cosmetics▷ Shaving Helpers▷ Fashion HatsFooding▷ Chef Club▷ Fooding Helpers▷ Coktails & LiquorsSports▷ Sport Shoes▷ Fitness & Detox▷ Golf Gear▷ Racquets▷ Diving Equipment▷ Ski Gear▷ Snowboards▷ Surf Boards▷ Rollers & SkatesEntertainment▷ DIY Guides▷ Zik Instruments▷ Published Books▷ Music Albums▷ Cine Movies▷ Trading Helpers▷ Make Money▷ Fishing Equipment▷ Paintball Supplies▷ Trading Card Games▷ Telescopes▷ Knives▷ VapesHigh Tech▷ Flat Screens▷ Tech Devices▷ Camera Lenses▷ Printers▷ USB Devices▷ PC Hardware▷ Network Gear▷ Cloud Servers▷ Software Helpers▷ Programmer Helpers▷ Mobile Apps▷ Hearing AidsHome▷ Home Furniture▷ Home Appliances▷ Beddings▷ Floor Layings▷ Barbecues▷ Aquarium Gear▷ Safe Boxes▷ Office Supplies▷ Security Locks▷ Cleaning ProductsKids▷ Baby Strollers▷ Child Car Seats▷ Remote ControlledTravel▷ Luggages & Bags▷ Airlines Seats▷ Hotel Rooms▷ Fun Trips▷ Cruise Ships▷ Mexico Tours