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.
Bandaru Prasad — — source: Informix-list mailing list archive (1991-1998)
Greeting All,
I am very new to Informix and infact I am not a database champion. I
have to right a small stored procedure in informix for a project that I
am working on and I read through the help files and had the skeleton
ready
but could not execute it as I am getting a syntax which I am not able ti
figure out. I wiam including the stored proedure below and was hoping to
get some help from some one.
Heres the small Stored Procedure
------------------------------------------------------------------------
CREATE FUNCTION 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
RETURN -100
ELSE
RETURN KeyValue
END IF
END FUNCTION
-----------------------------------------------------------------------
--
Thanks in advance for all your help.
Regards,
Prasad
--------------------------------------------
| |
| _/ _/ _/_/_/_/ _/ _/ |
| _/_/ _/ _/ _/ _/ |
| _/ _/ _/ _/_/_/ _/ _/ |
| _/ _/ _/ _/ _/ _/ |
| _/ _/_/ _/_/_/_/ _/_/_/_/_/ |
| |
--------------------------------------------
--------------------
PRASAD BANDARU
75 ALPHONSUS STREET#202
BOSTON MA
PH#(617)- 739- 7476
--------------------
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.