Procedures & Functions Flashcards

1
Q

Different types of Functions

A

Aggregate Function

Scalar Functions

User Defined Functions (UDF)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Aggregate Function

A
Returns a single calculated value.
Examples:
AVG()           LAST()         SUM()
COUNT()     MIN()
FIRST()         MAX()
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Scalar Function

A
Returns a single value based on input.
Examples:
UCASE()            LEN()          FORMAT()
LCASE()             ROUND()   MID()
NOW()
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

User Defined Functions

A

UDF Used for complex processing

Usually Input/Output

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Anonymous Block

A

An unnamed sequence of actions. Since they are not named they are not stored in the DB

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Stored Procedure

A

A named PL/SQL block which performs one or more specific tasks for repeated usage.

Has a header and a body
Header contains name of proc and variables or pram to passed to the proc
Body consists of declaration section, execution section and exception section

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q
PL/SQL Function
Stored Function (user or user defined function)
A

Set of PL/SQL statements call by name
Like a stored procedure but can only return 1 value

User function can be used in an SQL statement

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Deterministic Function

A

Always returns the same result for a specific input value

If you specify DETERMINISTIC improves the performance the second time called with the same parameter. No need to execute again for the result

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Package

A

A schema object that groups logically PL/SQL Types, items, and sub programs. Packages usually have two parts
Specifications (spec)
Body

A body is not always necessary

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Package Specification

A

Interface to your application
Declares the types, variables, constants, exceptions, cursors and sub programs available for use

Procedure and function declaration
Global declaration area

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Package Body

A

Fully defines cursors and sub programs and implements the specifications

Procedure and Function definition and exception handling
Local declaration

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Why would you use a Package

A

Organized code management- easy to locate
Easy (top down design) application design.
Painless implementation changes
Security and maintain ability through private code
New functionality session wide persistence of public variables
Better Performance first time entire package loaded into memory later calls better performance

How well did you know this?
1
Not at all
2
3
4
5
Perfectly