Declaring objects in pl/sql, PL-SQL Programming

Assignment Help:

Declaring Objects:

You can use the object types wherever built-in types like CHAR or NUMBER can be used. In the block below, you can declare object r of type Rational. Then, you can call the constructor for the object type Rational to initialize the object. The calls assign the values 6 & 8 to attributes num and den, correspondingly.

DECLARE

r Rational;

BEGIN

r := Rational(6, 8);

DBMS_OUTPUT.PUT_LINE(r.num); -- prints 6

You can declare objects as the formal parameters of the functions and procedures. In that way, you can pass objects to the stored subprograms and from one subprogram to the other. In the later illustration, you use the object type Account to specify the datatype of a formal parameter:

DECLARE

...

PROCEDURE open_acct (new_acct IN OUT Account) IS ...

In the illustration below, you can use object type Account to specify the return type of the function:

DECLARE

...

FUNCTION get_acct (acct_id IN INTEGER) RETURN Account IS ...

 


Related Discussions:- Declaring objects in pl/sql

Other monadic - sql, Other monadic - SQL In 2VL there are just 4 (2 2 ...

Other monadic - SQL In 2VL there are just 4 (2 2 ) monadic operators, of which negation is really the only "useful" one. When a third truth value is introduced we have 27 (3 3

Sql, Write a query to find academics that are authors and that have only ev...

Write a query to find academics that are authors and that have only ever coauthored papers with authors from institutes in the same state as their own. List their academic number,

Theory of catastrophism or catalysm - origin of life, THEO R Y OF CATASTR...

THEO R Y OF CATASTROPHISM OR CATALYSM (CUVIER 1769-1832) - The world has passed thorugh several stages and at the end of each stage there was a catastrophe killing all the

Avoiding collection exceptions, Avoiding Collection Exceptions   In ma...

Avoiding Collection Exceptions   In many cases, if you reference a nonexistent collection element, then PL/SQL raises a predefined exception. Consider the illustration shown b

Redeclaring predefined exceptions - user-defined exceptions, Redeclaring Pr...

Redeclaring Predefined Exceptions Keep in mind that, the PL/SQL declares predefined exceptions globally in the package STANDARD; Therefore you need not declare them yourself.

Multiple assignment - sql, Multiple Assignment- SQL SQL supports mult...

Multiple Assignment- SQL SQL supports multiple assignment to local variables and also applies multiple assignment semantics in SET clauses of UPDATE statements, but does not

Need for dynamic sql - pl sql , Need for Dynamic SQL: You need dynamic...

Need for Dynamic SQL: You need dynamic SQL in the situations as follows: 1) You would like to execute a SQL data definition statement (like CREATE), a data control statemen

Cursor for loops, Cursor FOR Loops In most cases that need an explicit ...

Cursor FOR Loops In most cases that need an explicit cursor, you can simplify the coding by using a cursor FOR loop rather of the OPEN, FETCH, and CLOSE statements. A cursor FO

Declaring exceptions - user-defined exceptions, Declaring Exceptions T...

Declaring Exceptions The Exceptions can be declared only in the declarative part of the PL/SQL subprogram, block, or package. By introducing its name, you can declare an excep

Keyword and parameter description - delete statement, Keyword and Parameter...

Keyword and Parameter Description: table_reference: This specifies a table or view that should be accessible when you execute the DELETE statement, and for that you must

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