Fabricante : HP
Arquivo Tamanho: 472.05 kb
Arquivo Nome :
|
por este dispositivo também tem outras instruções :
Facilidade de uso
Inside
pr
o
c
e
dur
e
Pur
chDB.DelV
endor:
DELETE
FROM
PurchDB.Orders
WHERE
VendorNumber
=
:VendorNumber;
RETURN
::sqlcode;
Messages
from
Errors
Caused
b
y
the
RAISE
ERROR
Statement
The
RAISE
ERR
OR
statement
pro
vides
a
w
a
y
of
sp ecifying
y
our
o
wn
error
message
n
um
b ers
and
text.
This
is
v
ery
useful
inside
pro cedures
that
are
triggered
b
y
rules,
and
it
is
also
useful
if
y
ou
wish
to
build
a
set
of
error
messages
of
y
our
o
wn.
RAISE
ERR
OR
lets
y
ou
assign
an
error
n
um
b er
and
a
message,
as
in
the
follo
wing
example:
RAISE
ERROR
7001
MESSAGE
'Vendor
number
exists
in
the
"Orders"
table.';
The
n
um
b er
range
7000-7999
is
reserv
ed
for
use
b
y
this
statement
(that
is,
no
ALLBASE/SQL
errors
app ear
in
this
range).
In
the
previous
example,
when
the
RAISE
ERR
OR
statement
executes,
the
n
um
b er
07001
is
placed
in
the
lo
cal
v
ariable,
::sqlco
de,
and
y
ou
can
test
for
the
error
within
the
pro cedure.
After
exiting
the
pro cedure,
SQLCODE
is
set
to
07001
if
a
WHENEVER
SQLERR
OR
STOP
statement
is
in
eect.
The
following
example
illustrates
the
use
of
a
RAISE
ERR
OR
statement
in
an
application
that
tests
for
errors
follo wing
the
execution
of
a
pro cedure
b
y
a
rule
triggered
b
y
a
DELETE
statement.
An
error
is
raised
in
pro cedure
Purc
hDB.DelV
endor
and
display
ed
on
return
to
the
calling
application.
The
calling
application
includes
the
follo
wing
DELETE
statement:
DELETE
FROM
PurchDB.Vendors
WHERE
VendorNumber
=
:VendorNumber
The
attempted
deletion
res
rule
Purc
hDB.Chec
kV
endor,
whic
h
in
v
ok
es
pro cedure
Purc
hDB.DelV
endor.
The
pro cedure
allo
ws
the
deletion
to
take
place
only
if
the
v
endor
n
um
b er
is
not
found
in
other
tables.
If
the
v
endor
n
um
b er
do es
app ear
in
some
other
table,
an
error
results.
SQLCODE
is
set
to
the
n
um
b er
of
the
raised
error,
and
messages
like
the
follo wing
are
returned
to
the
message
buer,
from
whic
h
they
can
b e
display
ed
with
SQLEXPLAIN
b
y
the
application
that
encoun
tered
the
error:
Vendor
number
exists
in
the
"Orders"
table.
Error
occurred
executing
procedure
PURCHDB.DELVENDOR
statement
8.
(DBERR
2235)
INSERT/UPDATE/DELETE
statement
had
no
effect
due
to
execution
errors.
(DBERR
2292)
In
the
rst
message,
the
raised
error
rep orts
that
the
v
endor
n
um
b er
exists
in
the
Orders
table.
A
second
message
in
the
buer
iden
ties
the
lo
cation
in
the
pro cedure
of
the
RAISE
ERR
OR
statement
that
con
tained
the
rst
message.
The
third
message
rep orts
the
failure
of
the
DELETE
statement
that
red
the
Purc
hDB.Chec
kV
endors
rule,
whic
h
in
turn
in
v
ok
ed
the
Purc
hDB.DelV
endor
pro cedure.
Note
that
for
an
error
raised
in
a
pro cedure
called
b
y
an
application,
SQLCODE
and
SQL
W
ARN0
are
set
as
describ ed
in
the
previous
section,
\Messages
from
Errors
Caused
b
y
the
RAISE
ERR
OR
Statemen
t."
RAISE
ERR
OR
is
the
same
as
other
SQL
statements
in
that
within
or
outside
of
a
pro cedure
the
message
buer
is
cleared
of
other
errors
b efore
the
raised
error
is
stored.
(Messages
for
PRINT
and
PRINTR
ULES
remain
un
til
the
pro cedure
returns
to
the
calling
application.)
Therefore,
it
is
most
useful
for
errors
that
cause
the
pro cedure
to
return
in
an
error
state.
5-18
Using
Procedures
in
Application
Programs
... Este manual também é adequado para os modelos :
Software - MPE/iX 6.5 Operating System (472.05 kb)
Software - MPE/iX 7.0 Operating System (472.05 kb)
Software - MPE/iX 7.5 Operating System (472.05 kb)