Subject | selectable SP, exception handling |
---|---|
Author | cornel rebegea |
Post date | 2009-12-21T21:49:11Z |
Hi,
I'm struggling with an selectable SP, maybe I don't know the correct syntax.
This is what I'm trying to do: return the records of a table and on each line I want to add
2 other columns that I calculate on spot (this being the role for the SP finally).
It wouldn't work with "computed by" because it is a slightly more complicated calculation.
Practically, I need to separate the numerical and literal part of a value to achieve a more convenient ordering.
So this is what I do:
CREATE PROCEDURE CRS_NUMBERS_ORD
RETURNS ( COD INTEGER ,
NR VARCHAR(50),
NR_NUM integer )
AS
DECLARE num integer;
begin
/* Procedure Text */
for
select COD,
NR
from numere_camera
into :COD,
:NR do
begin
/* here I will make repeated casts and checks to get the numerical part ,
I need to handle the exception so the SP does not stop */
num = CAST('355a' as integer);
IF (num > 0)
then NR_NUM = num;
else //repeat, whatever this needs more work
when any do begin
exception ;
end
suspend; // this is where it stumbles
end
end
The problem is that the parser says that suspend is "invalid token".
So what do I miss?
Thanks in advance,
Cornel
[Non-text portions of this message have been removed]
I'm struggling with an selectable SP, maybe I don't know the correct syntax.
This is what I'm trying to do: return the records of a table and on each line I want to add
2 other columns that I calculate on spot (this being the role for the SP finally).
It wouldn't work with "computed by" because it is a slightly more complicated calculation.
Practically, I need to separate the numerical and literal part of a value to achieve a more convenient ordering.
So this is what I do:
CREATE PROCEDURE CRS_NUMBERS_ORD
RETURNS ( COD INTEGER ,
NR VARCHAR(50),
NR_NUM integer )
AS
DECLARE num integer;
begin
/* Procedure Text */
for
select COD,
NR
from numere_camera
into :COD,
:NR do
begin
/* here I will make repeated casts and checks to get the numerical part ,
I need to handle the exception so the SP does not stop */
num = CAST('355a' as integer);
IF (num > 0)
then NR_NUM = num;
else //repeat, whatever this needs more work
when any do begin
exception ;
end
suspend; // this is where it stumbles
end
end
The problem is that the parser says that suspend is "invalid token".
So what do I miss?
Thanks in advance,
Cornel
[Non-text portions of this message have been removed]