What is the Scalar Data type in PL/SQL?what is the forward decleration in packages?what is the usage of IN,OUT,INOUT parameters in Procedures or functions?

Showing Answers 1 - 9 of 9 Answers

richa

  • Feb 12th, 2006
 

there are two types of data types available 1n pl/sql

1. scaler

2.composite

scaler datatypes are those which  hold a single value and donot have any internal components they are clasified into 4 catagories

1.character,2.number,3.date,boolean.Base scaler datatypes are char,varchar2(),long,longraw,number,binary_integer,boolean

Base scaler datatypes are ,date,timestamp etc.

the parameters in,out,inout parameters used in pl/sql

in parameter is used to input data from the user, out parameter is used to display the data or to retrieve information from the table..and through inout parameter you can pass values into a procedure and return a value.

Rachana

  • Feb 17th, 2006
 

FWD declarations in pkg -  the pkg has defination and a body for procedures and funcs. a fwd declaration is cosists simply of the program header, followed semicolon. this header is declared in advance of the actual program defination and the program is available for use even before its defination.

  Was this answer useful?  Yes

raj

  • Oct 17th, 2006
 

Hi

Scalar datatypes are the datatypes which hold a single value like char, varchar, number, etc. whereas the composite datatypes are date, timestamp etc. Hope this tip helps you...

bye..

  Was this answer useful?  Yes

Donald H. Kirschman

  • Dec 27th, 2006
 

Scalar data types store one single element of data, as opposed to composite data types.  This is not a concept that is unique to Oracle PL/SQL; rather, it is common to any programming language.  Scalar types specific to Oracle include Integer, Number, Char, Varhar2, Boolean, etc. 

In PL/SQL (and other languates, like Pascal) a program unit, such as a procedure or function, must be defined before it can be invoked by another program unit.  In PL/SQL package bodies, forward declarations provide an optional means to get around this.  You declare all program units before they actually appear in the package.  A forward declaration is merely the name of the program unit and any parameters required.  With forward declarations in place, you are now free to arrange the program units in the package body in any order so as to improve readability or group program units together logically.  Note that forward declaratiosn are not required, so long as you code a program unit before it is called.  Additionally, forward declarations can appear anywhere, not just at the top of the package body.  Anytime you declare a program unit in advance of the actual coding, that is a forward declaration.

IN, OUT and INOUT refer to the mode of the parameter.  This, too is a general concept that is not unique to PL/SQL.  IN defines a parameter as Input, which means that the parameter is only used to provide a value to a program unit and nothing is returned.  INOUT defines a parameter as Input/Output.  This means that the parameter provides a value to the program unit and that the program unit may change the value of the parameter.  OUT defines a parameter as Output only, meaning that nothing is actually passed in to the parameter when calling the program unit, but a value is retured.  Output parameters are less useful and you would be hard pressed to find a situation where you need to use one.

Input parameters are also called value parameters or they are said to be passed by value.  Input/Output parameters are also called variable, address or reference parameters, since they change values and the passing of the parameter is actually an address or memory location (a reference) to a place where the parameter is stored and can be changed by the called program unit.

  Was this answer useful?  Yes

Guest

  • Jan 16th, 2007
 

A forward declaration looks like the package definition part but is inside the bode.
e.g.
procedure A is
begin
  B;
end A;
procedure B is
begin
  null;
end B;
will not work, because during call to B B is still unknown (1 Step compiler) therefore we need a forward declaration:
procedure B;
procedure A is
begin
  B;
end A;
procedure B is
begin
  null;
end B;

now we can compile

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions