Methods in pl/sql, PL-SQL Programming

Assignment Help:

Methods:

In normal, a method is a subprogram declared in an object type specification using the keyword MEMBER or STATIC. The method cannot have similar name as the object type or any of its attributes. The MEMBER methods are invoked on instances, as in the

instance_expression.method()

Though, the STATIC methods are invoked on the object type, not its instance, as in

object_type_name.method()

Similar packaged subprograms, many methods have 2 parts: the specification and the body. The specification consists of an optional parameter list, a method name, and, for functions, the return type. The body is a code that executes to perform the specific task.

For each method specification in an object type specification, there should be a corresponding method body in the object type body. To match the method specifications & bodies, the PL/SQL compilers do a token-by-token comparison of their headers. Therefore, the headers should match the word for word.

In an object type, the methods can reference the attributes and another method without a qualifier, as the illustration below shows:

CREATE TYPE Stack AS OBJECT (

top INTEGER,

MEMBER FUNCTION full RETURN BOOLEAN,

MEMBER PROCEDURE push (n IN INTEGER),

...

);

CREATE TYPE BODY Stack AS

...

MEMBER PROCEDURE push (n IN INTEGER) IS

BEGIN

IF NOT full THEN

top := top + 1;

...

END push;

END;


Related Discussions:- Methods in pl/sql

Using the collection methods, Using the Collection Methods The collecti...

Using the Collection Methods The collection methods below help to generalize the code and make collections easier to use and also make your applications easier to maintain:

Check constraints in sql, CHECK Constraints in SQL A CHECK constraint ...

CHECK Constraints in SQL A CHECK constraint is a table constraint defined using the key word CHECK, as already illustrated in several examples in this chapter. In particular,

%found - explicit cursor attributes, %FOUND Subsequent to a cursor or ...

%FOUND Subsequent to a cursor or cursor variable is opened but before the first fetch, the %FOUND yields NULL. Afterward, it yields TRUE when the last fetch returned a row, or

Use the nocopy compiler hint - performance of application, Use the NOCOPY C...

Use the NOCOPY Compiler Hint By default, the OUT and IN OUT parameters are passed by the value i.e. the value of an IN OUT actual parameter is copied into the corresponding fo

Effects of null for union - sql, Effects of NULL for union - SQL The ...

Effects of NULL for union - SQL The treatment of NULL in invocations of EXCEPT is as for UNION. This is different from its treatment in those of NOT IN and quantified compari

Explicitly specifying the join condition - sql, Explicitly specifying the j...

Explicitly specifying the join condition - SQL SELECT * FROM IS_CALLED JOIN IS_ENROLLED_ON ON ( IS_CALLED.StudentId = IS_ENROLLED_ON.StudentId ) Now, the key word JO

Sql outer join, SQL outer join SELECT * FROM IS_CALLED NATURAL LEFT...

SQL outer join SELECT * FROM IS_CALLED NATURAL LEFT JOIN IS_ENROLLED_ON Note that adding LEFT to an invocation of CROSS JOIN has no effect unless the right-hand operand

Authorize and fetch data from instagram, Authorize and fetch data from Inst...

Authorize and fetch data from Instagram Project Description: Incorporate Instagram feed on mobile site platform: c#, ms sql, jquerymobile, jquery Web admin Author

Synonyms- naming conventions, Synonyms You can create the synonyms to pr...

Synonyms You can create the synonyms to provide location transparency for the remote schema objects like tables, views, sequences, stand-alone subprograms, and packages. Though,

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd