This forum is currently locked. You can't register or post questions at this time. (read more)

Help Packet

All posts relating to Oracle PL/SQL development.

Moderator: Tim...

Pande
Member
Posts: 1
Joined: Thu Jun 06, 2013 9:59 am

Help Packet

Postby Pande » Thu Jun 06, 2013 10:01 am

Hello guys, Im new to the forum :/


I have a problem about the Packets.

How can I make a mathematic packet that had functions and procedures?

I have to calculate the area and perimeter of a Pentagon.

Thanks all :(

Tim...
Site Admin
Posts: 18437
Joined: Mon Nov 01, 2004 5:56 pm
Location: England, UK
Contact:

Re: Help Packet

Postby Tim... » Thu Jun 06, 2013 10:22 am

Hi.

I think you mean package, not packet. :)

It sounds to me like someone has been given some homework and is looking for someone else to do their work for them...

There are two things to consider here.

1) How do you create a package. I can help with that.

2) How do you calculate the area and perimeter of a pentagon. You can Google this I guess.

The basic layout of a package containing a procedure and a function is shown below.

First the package specification:

Code: Select all

CREATE OR REPLACE PACKAGE my_package AS

PROCEDURE my_proc (p_in_1 IN NUMBER, p_in_2 IN NUMBER);

FUNCTION my_func (p_in_1 IN NUMBER, p_in_2 IN NUMBER) RETURN NUMBER;

END my_package;
/


Next the package body.

Code: Select all

CREATE OR REPLACE PACKAGE BODY my_package AS

PROCEDURE my_proc (p_in_1 IN NUMBER, p_in_2 IN NUMBER) IS
BEGIN
  -- Do something with your input parameters here.
  NULL;
END;

FUNCTION my_func (p_in_1 IN NUMBER, p_in_2 IN NUMBER) RETURN NUMBER IS
BEGIN
  -- Do something with your input parameters here and return a value.
  RETURN NULL;
END;

END my_package;
/


You can alter the name and the contents to your hearts content.

Cheers

Tim...
Tim...
Oracle ACE Director
Oracle ACE of the Year 2006 - Oracle Magazine Editors Choice Awards
OakTable Member
OCP DBA 7.3, 8, 8i, 9i, 10g, 11g
OCP Advanced PL/SQL Developer
Oracle Database: SQL Certified Expert
My website: http://www.oracle-base.com
My blog: http://www.oracle-base.com/blog


Return to “Oracle SQL and PL/SQL Development”

Who is online

Users browsing this forum: No registered users and 6 guests

cron