Translating with DrWatson… this can take a few seconds the first time.
This is a genuine, complex translation. DrWatson protects commands, error codes, and log output while naturally translating the surrounding text. It’s translated once and saved.
Prasad
Havent actually run it but here are some syntax things that I noticed that
are wrong with your SP. I have marked my changes within << >> marks.
CREATE <<PROCEDURE>> GetNextSeqNumber (tablename char(20))
RETURNING INTEGER;
-- Define the variables Now
DEFINE Keyvalue INTEGER;
DEFINE RowsUpdated INTEGER;
-- NOW EXECUTE THE SQL STATEMENT
UPDATE SequenceNumber
SET KeyValue = CurrentSeqNumber = NextSeqNumber,
NextSeqNumber = (NextSeqNumber + IncrementBy),
--LastUpdateDate = today
WHERE TableName = tablename
AND MaximumValue > (NextSeqNumber + IncrementBy) <<;>>
--Now get the number of rows updated into the local varible.
LET RowsUpdated = DBINFO('sqlca.sqlerrd2');
--Now Check if Succesfull
IF RowsUpdated = 0 <<THEN>>
RETURN -100 <<;>>
ELSE
RETURN KeyValue <<;>>
END IF<<;>>
END <<PROCEDURE>><<;>>
HTH
Sujit
We use strictly necessary cookies to make this site work. With your
consent we’d also use optional cookies for analytics and marketing. You can accept all,
reject all, or choose. Read our Cookie Policy.