Home » SQL & PL/SQL » SQL & PL/SQL » Package and Package Body
Package and Package Body [message #35930] Wed, 24 October 2001 12:19 Go to next message
Poonamb
Messages: 16
Registered: October 2001
Junior Member
Hello,

I have a package as below and multiple procedures thereafter.
What I am not clear is

-> how do the multiple type parameters in package work??
-> What is their purpose/relevance?
-> In the package body where the below mentioned procedure is written,
what is returned in tHeadln?
-> The entire purpose of creating such a package/package body?

I have to make some modifications to this but am not clear with the
functionality. Please explain.

CREATE OR REPLACE PACKAGE TestCases AS

type returnCursor is ref cursor;
type tHeadln is table of varchar2(300)
index by BINARY_INTEGER;
type tDateTime is table of Date
index by BINARY_INTEGER;
type tSourceInfo is table of varchar2(255)
index by BINARY_INTEGER;
type tLastName is table of varchar2(40)
index by BINARY_INTEGER;
type tNumber is table of number
index by BINARY_INTEGER;

PROCEDURE GetToMessage(MySymbol in varchar2,
MyStory in Number,
MyHeadLn out tHeadln,
MyDate out tDateTime,
MyConcept out tCONCEPT_N,
MyDocId out tNumber,
MySourceLn out tHeadln);

Thanks in advance!

----------------------------------------------------------------------
Re: Package and Package Body [message #35931 is a reply to message #35930] Wed, 24 October 2001 12:44 Go to previous messageGo to next message
Todd Barry
Messages: 4819
Registered: August 2001
Senior Member
-> how do the multiple type parameters in package work?

They are not parameters, but rather type declarations. A type declaration allows the type to then be used elsewhere, including as a parameter type as you see in the GetToMessage procedure.

-> What is their purpose/relevance?

See above.

-> In the package body where the below mentioned procedure is written, what is returned in tHeadln?

A PL/SQL table consisting of 0 or more varchar2(300) strings. There is an OUT parameter declared in GetToMessage of type tHeadln called MyHeadln and in the procedure there will be some kind of manipulation (adds most likely) of that variable.

-> The entire purpose of creating such a package/package body?

In order to use parameters of these types, the types must be declared in a package spec. They can be referred to then within that same package or other packages/procs/functions.

----------------------------------------------------------------------
Re: Package and Package Body [message #35933 is a reply to message #35931] Wed, 24 October 2001 13:54 Go to previous message
Todd Barry
Messages: 4819
Registered: August 2001
Senior Member
Almost - procedure/functions in this or any other package, as well as standalones, may reference these types when declaring parameters.

----------------------------------------------------------------------
Previous Topic: Dynamic query execution
Next Topic: What is it??
Goto Forum:
  


Current Time: Tue Apr 16 13:14:08 CDT 2024