Re-initializes a random variable using the RndPerN random type or RndStream type. This Reset function restores all or a part of the drawn values of the random variable.
Reset( inout rvar, in nMaximum : number optional );
Parameter | Description |
---|---|
rvar | Random variable using the RndPerN random type or RndStream type |
nMaximum | New maximum value of the random variable (optional); all values up to this value are restored. If nMaximum is omitted, all values up to the specified maximum value of the random type are restored. |
var vArtNo: number; dclrand rArtNo : RndPerN(1..10000); rVenNo : RndPerN(100); dcltrans transaction t1 var i: number; begin vArtNo := rArtNo; c1: InsArticle(); for i := 1 to 10 do c1: InsArtVen(); end; Reset(rVenNo, 50); ... end t1; dclsql InsArticle: INSERT INTO article (articlenumber, ...) VALUES (:vArtNo, ... InsArtVen: INSERT INTO artven (articlenumber, vendornumber, ...) VALUES (:vArtNo, :rVenNo, ...)
The random variable rArtNo is used to generate unique article numbers between 1 and 10000. To ensure that the article numbers generated are unique, the RndPerN random type is used instead of RndUniN. The random variable rVenNo is used to generate unique vendor numbers for each article. To allow the same vendor number for different articles, rVenNo is re-initialized at the and of the transaction. After the first call of transaction t1, only vendor numbers between 1 and 50 have been used.