0% found this document useful (0 votes)
68 views49 pages

Flow

The document discusses VARRAYs and nested tables in Oracle databases. It notes that VARRAYs have a maximum size, are always dense, and retain ordering when stored in the database. Nested tables are unbounded, can be sparse, do not retain ordering when stored, and support indexes. The document provides examples of using collection methods like COUNT, LIMIT, and DELETE on VARRAYs and nested tables. It also covers bulk binding of collections to SQL statements using FORALL and BULK COLLECT for improved performance.

Uploaded by

kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
68 views49 pages

Flow

The document discusses VARRAYs and nested tables in Oracle databases. It notes that VARRAYs have a maximum size, are always dense, and retain ordering when stored in the database. Nested tables are unbounded, can be sparse, do not retain ordering when stored, and support indexes. The document provides examples of using collection methods like COUNT, LIMIT, and DELETE on VARRAYs and nested tables. It also covers bulk binding of collections to SQL statements using FORALL and BULK COLLECT for improved performance.

Uploaded by

kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 49

ame

as

VARRAY.

P2P

Interview

Preparation

-‐

by

Dinesh

Kumar

VARRAY

NESTED

TABLE

varrays

have

maximum

size

i.e.

bounded

Nested

tables

are

unbounded

But

not

from

varray.

Whereas
varrays

are

always

dense.

Individual

elements

can

be

deleted

from

nested

table.

The

nested

tables

can

be

sparse

Varrays

are

stored

by

Oracle

in-‐line

(in

the

same

tablespace)

Nested

table
data

is

stored

out-‐of-‐line

in

store

table

which

is

system-‐generated

database

table

associated

with

the

nested

table.

When

stored

in

the

database,

varrays

retain

their

ordering

and

subscripts.

When
stored

in

the

database,

nested

tables

do

not

retain

their

ordering

and

subscripts,

varrays

do

not

indexes

Nested

tables

support

indexes

Associative

Arrays

(or)

Index

by

Table

(or)

PLSQL

Table:

What
VARRAY

and

NESTED

TABLE

cannot

do?

Associating

Key

value

with

array.

Syntax:

TYPE

<type_name>

IS

TABLE

OF

NUMBER

INDEX

BY

PLS_INTEGER;

TYPE

<type_name>

IS

TABLE

OF

NUMBER

INDEX

BY

VARCHAR2
(20);

TYPE

<type_name>

IS

TABLE

OF

VARCHAR2

(20)

INDEX

BY

PLS_INTEGER;

Note**

The

Key

is

always

UNIQUE

&

NOT

NULL.

P2P

Interview

Preparation

-‐

by

Dinesh

Kumar

Manipulating

Collections:

This
is

done

by

built-‐in

functions

and

procedures

called

“Collection

Methods”.

COUNT

Counts

no.

of

elements

with

values

Example:

V2.COUNT;

LIMIT

Current

Max.

Size

of

Array

Example:

V2.LIMIT

FIRST

Return

1st

element
value.

Example:

V2.FIRST

LAST

Returns

last

element

value.

Example:

V2.LAST

PRIOR

Returns

prior

value

of

current

element

Example:

V2.PRIOR(3)

EXTEND

Extend

the

size

of

the

array.

Example:

V2.EXTEND(5)

TRIM

Decrease

the
size

of

the

array

Example:

V2.EXTEND(5)

DELETE

Deletes

the

value

of

specific

element.

Does

not

apply

to

VARRAY.

EXISTS

(n)

Checks

any

key

available,

if

YES

returns

TRUE

NO

returns

FALSE
NEXT

Returns

next

key

value

Bulk

Binding:

P2P

Interview

Preparation

-‐

by

Dinesh

Kumar

What

is

Bulk

Binding?

The

assignment

of

values

to

PL/SQL

variables

in

SQL

statements

is

called
binding.

The

binding

of

an

entire

collection

at

once

is

referred

to

as

bulk

binding.

What

is

the

Advantage?

Bulk

binds

improve

performance

by

minimizing

the

number

of

context

switches

between
PL/SQL

and

SQL

engines

while

they

pass

an

entire

collection

of

elements

(varray,

nested

tables,

index-‐by

table,

or

host

array)

as

bind

variables

back

and

forth.

Prior

to

Oracle8i,

the

execution
of

every

SQL

statement

required

switch

between

the

PL/SQL

and

SQL

engines,

whereas

bulk

binds

use

only

one

context

switch.

How

to

Bulk

Bind?

Bulk

binding

includes

the

following:

1. Input
collections,

use

the

FORALL

statement

2. Output

collections,

use

BULK

COLLECT

clause

Input

Collections:

Input

collections

are

data

passed

from

the

PL/SQL

engine

to

the

SQL

engine

to

execute

INSERT,

UPDATE,

and
DELETE

statements.

FORALL

index

IN

lower_bound..upper_bound

sql_statement;

Note:

If

FORALL

statement

fails,

then

database

changes

are

rolled

back

to

an

implicit

savepoint

marked

before

each

execution

of

the

SQL

statement.
P2P

Interview

Preparation

-‐

by

Dinesh

Kumar

Output

Collections:

Output

collections

are

data

passed

from

the

SQL

engine

to

the

PL/SQL

engine

as

result

of

SELECT

or

FETCH

statements.
The

keywords

BULK

COLLECT

can

be

used

with

SELECT

INTO,

FETCH

INTO,

and

RETURNING

INTO

clauses.

The

syntax

is

as

follows:

...

BULK

COLLECT

INTO

collection_name[,

collection_name]

....

Example:

SELECT

INTO
Example:

FETCH

INTO

Restriction:

You

cannot

bulk-‐fetch

from

cursor

into

collection

of

records.

P2P

Interview

Preparation

-‐

by

Dinesh

Kumar

Example:

Cursor

Attribute

The

new

composite

cursor

attribute
for

bulk

binds

is

%BULK_ROWCOUNT.

It's

syntax

is

as

follows:

IF

SQL%BULK_ROWCOUNT(i)

...

THEN

.....

ENDIF;

P2P

Interview

Preparation

-‐

by

Dinesh

Kumar

Oracle Interfaces Overview

PO

Import:

Program

Name:

Import
Standard

Purchase

Orders

Short

Name:

POXPOPDOI

Application:

Purchasing

Executable:

POXPDOI

Executable

Method:

SQL*Plus

Tables:

Table

Name

Mandatory

Columns

PO_HEADERS_INTERFACE

§ INTERFACE_HEADER_ID

PO_LINES_INTERFACE

§ INTERFACE_LINE_ID

§ INTERFACE_HEADER_ID

PO_DISTRIBUTIONS_INTERFACE

§ INTERFACE_LINE_ID

§ INTERFACE_HEADER_ID

§ INTERFACE_DISTRIBUTION_ID

PO_INTERFACE_ERRORS

§ INTERFACE_TYPE

§ INTERFACE_TRANSACTION_ID

§ CREATION_DATE
§ CREATED_BY

§ LAST_UPDATE_DATE

§ LAST_UPDATED_BY

FAQ

-‐

PO

Import:

What

should

do

if

the

Purchase

Document

Open

Interface

(PDOI)

process

fails?

The

first

thing

is

to

check

for

the

error

message

and
examine

description

from

the

po_interface_errors

table

for

the

given

interface_header_id.

The

description

would

be

self

explanatory.

Accordingly

check

for

the

data

in

the

po_headers_interface,

po_lines_interface

tables

and

correct

them

and

run
the

PDOI

again

with

the

corrected

data.

How

do

to

get

the

log

file

for

the

PDOI

run?

To

get

the

log

file

for

the

PDOI

set

the

following

profile
option

to

Yes

PO:

Write

server

output

to

file.

How

to

view/purge

and

correct

the

errors

tables?

To

view

the

errors

run

the

following

Report:

Purchasing

interface

error

report.

To
Purge

the

error

and

interface

tables

run

the

following

Reports:

Purge

purchasing

open

interface

processed

data

report.

Purchasing

interface

error

report.

P2P

Interview

Preparation

-‐

by

Dinesh

Kumar

What

do
I

do

when

POs

are

not

being

picked

up

by

PDOI

and

these

records

remain

in

pending

status?

Check

if

the

client

is

single

org

instance.

If

you

are

using
single

org

instance

then

you

are

not

supposed

to

populate

the

org_id

in

the

interface

tables.

Org_id

should

be

null

for

single

org

implementation.

How

should

populate

the

project
and

task

information

in

PDOI?

The

point

to

be

noted

here

is

that

always

populate

project

name

and

task

name

into

the

project

and

task

column

of

po_headers_interface

table

instead

of
project

number

and

task

number.

Based

on

project

name

and

task

name

PDOI

derives

the

project_id

and

task_id

and

inserts

in

the

po_distributions

table.

What

should

do

if

PDOI

errors
out

with

"po_pdoi_invalid_dest_type

destination

type

(value

expense)

is

not

valid"

for

expense

items?

This

Error

can

arise

out

of

following

situation:

1.

Validation

of

destination

organization

id

fails.

2.

Validation
of

destination

type

code

fails.

3.

Item_id

is

NULL

and

destination_type_code

is

INVENTORY.

4.

Validation

of

destination

subinventory

fails.

5.

Destination_type_code

in

('SHOP

FLOOR','EXPENSE')

and

destination_subinventory

is

not

null.

6.

Validation
of

destination

organization

id

fails.

Can

you

update

documents

via

PDOI

which

were

created

manually?

Yes

we

can

update.

Its

important

to

note

that

it

is

necessary

to

supply

DOCUMENT_NUM

in
the

PO_HEADERS_INTERFACE

when

trying

to

update

blanket

purchase

agreements

which

has

not

been

created

through

the

PDOI.

For

documents

created

through

PDOI,

VENDOR_DOC_NUM

can

be

specified

in

the

PO_HEADERS_INTERFACE.

Why

does
PDOI

error

out

with

"ora-‐00001

unique

constraint

violation

in

po_headers_u2"?

Though

this

issue

may

occur

rarely

but

it

can

and

its

explained

below:

The

document

number

is

generated

at

the

end
of

the

PDOI

process

before

commit

and

updated

in

the

po_headers

table.

When

the

PDOI

process

starts,

po_headers

table

is

updated

with

poi_temp_po_b679535

value

in

segment1

and

then

later

after

headers
and

lines

are

processed

document_number

is

generated

and

the

po_headers

is

updated

with

that.

Assume

for

any

reason

on

account

of

an

incomplete

transaction

there

is

record

in

po_headers

table
with

poi_temp_po_b679535

value

in

segment1

then

PDOI

would

fail

with

the

above

error

message.

So

just

check

for

record

in

po_headers

table

with

poi_temp_po_b679535

value

of

the

segment1

for

this
error.

How

is

data

deleted

from

the

interface

tables

after

it

has

been

loaded?

After

successful

creation

of

data

through

PDOI,

the

process_code

in

the

interface

tables

will

be

set

to
'Accepted'.

If

the

Customer

wants

to

delete

this

interface

data

which

is

used

no

more

then

they

need

to

run

the

concurrent

request

'Purge

purchasing

interface

processed

data'.

had

loaded
all

the

data

into

the

interface

tables

and

with

process_code

as

'PENDING'.

run

the

PDOI

program,

but

data

is

not

getting

picked

up

by

PDOI.

The

records

remain

in

status
'PENDING'

in

the

interface

tables.

What

do

do?

Check

whether

client

is

single

org.

If

they

are

single

org,

then

they

should

not

populate

org_id

into

the

interface

tables.

make
the

org_id

null

in

the

interface

tables

and

re-‐run

PDOI.

P2P

Interview

Preparation

-‐

by

Dinesh

Kumar

want

to

update

header

of

document.

Is

it

possible

via

PDOI?
No.

It

is

not

possible

to

update

header

information

but

only

line

information

can

be

updated

from

PDOI.

you

can

use

'Replace'

option

to

replace

the

entire

document

in

this

case.
I

am

trying

to

update

item

description

through

PDOI.

The

program

is

updating

the

item

description

at

the

line

level

but

is

not

updating

the

same

at

item

master.

This

is
desired

functionality

of

PDOI.

PDOI

will

only

update

the

item

description

at

the

line

level

and

not

at

item

master.

The

first

thing

is

to

check

for

the

error

message

and
examine

description

from

the

po_interface_errors

table

for

the

given

interface_header_id.

The

description

would

be

self

explanatory.

Accordingly

check

for

the

data

in

the

po_headers_interface,

po_lines_interface

tables

and

correct

them

and

run
the

PDOI

again

with

the

corrected

data.

What

documents

types

are

supported

Currently,

the

Purchasing

Document

Open

Interface

can

import

the

following:

Blanket

Quotation

Item

Sourcing

Rules

**

Standard

Purchase
Orders

can

be

imported

through

POXPDOI

in

Release

11i

only

with

one-‐off

Patch

1550991.

This

one-‐off

patch

will

also

be

included

in

11i.PO.D.

**

Standard

Purchase

Orders

cannot

be

imported

in
release

11.0.X

**

Blanket

Releases

cannot

be

imported

in

any

release

What

Actions

ar

You might also like