-
is STEP function in oracle?
Cheers!
OraKid.
-
Did you read or test in Oracle?
-
HI Balaji,
TO my knowledge, there is no built-in function named "Step" in Oracle. I would lprefer you to download the Orcle documentation from Oracle site or buy a fundemental Oracle book.
Thanks,
GD_1976.
-
hi,
my requirement is the FOR LOOP should increment by 5 values.
(eg) FOR i IN 1..100 LOOP
...stmt
END LOOP;
now i use MOD function to get the 5th row
i want a simple function
thanx guys
Cheers!
OraKid.
-
First, I would do as everyone suggested and figure out how to get to the documentation.
The easiest way is to simply make a free account on Oracle Technology Network. This would then allow you to get to this link:
http://otn.oracle.com/docs/products/..._struc.htm#685
There, you would find the following:
Some languages provide a STEP clause, which lets you specify a different increment (5 instead of 1 for example). PL/SQL has no such structure, but you can easily build one. Inside the FOR loop, simply multiply each reference to the loop counter by the new increment. In the following example, you assign today's date to elements 5, 10, and 15 of an index-by table:
DECLARE
TYPE DateList IS TABLE OF DATE INDEX BY BINARY_INTEGER;
dates DateList;
k CONSTANT INTEGER := 5; -- set new increment
BEGIN
FOR j IN 1..3 LOOP
dates(j*k) := SYSDATE; -- multiply loop counter by increment
END LOOP;
...
END;
Unfortunately, there is no STEP function in PL/SQL - spiffy, eh?
HTH,
- Chris
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|