Tuesday, August 21, 2007

Blogging about 11g : Allow Sequences in PL/SQL Expressions

My company took part in the Oracle 11 g Beta test and I also ran some (small) test on the new PL/SQL features. One of them is that access to sequences is allowed in PL/SQL, so no need to "SELECT tst_seq.nextval INTO n FROM dual" anymore!
DECLARE
  n NUMBER;
BEGIN
  SELECT seq.nextval
  INTO n
  FROM dual;
END;
can now be coded as
DECLARE
  n NUMBER;
BEGIN
  n := seq.nextval;
END;
For "currval" the same solution is possible. So there is no need for a cursor anymore, but more important to me : the usability and readability of the PL/SQL is code is enhanced by this new feature.
Post a Comment