Every day I read posts that start "I was going to blog about X but Y beat me to it". It looks like it's my turn. I've been sitting on a post for improvements I'd like to see to PL/SQL, and it turns out Steven Feuerstein has set up a site to capture PL/SQL improvements we'd all like to see. Dag-nab-it!
Anyway, the gist of my original post follows, slightly rewritten to make it look like I didn't think of the idea first ;)
With the arrival of Oracle 11g we see a new set of features for PL/SQL. PL/SQL from my point of view has always been the ideal procedural language for the Oracle database, as many years ago I programmed with Ada which was the basis for PL/SQL syntax so I didn't have to learn a new language from scratch, I find the syntax very easy and clear to work with, and a breeze to teach (compared to Java for instance).
From experience, my positive outlook on PL/SQL is shared by a number of Oracle experts out there, with the main comment being "PL/SQL does what it needs to do." In other words it's a very mature language.
This doesn't mean that we shouldn't drive for further innovation in the PL/SQL language though, as there are many features in other languages that could make our PL/SQL programming experience more rewarding. If you look at the Java camp, committees upon committees, and blog entries upon blog entries are dedicated to improvements in the language for the next version. I can't say I've seen the same for PL/SQL, so Steve's initiative here is a good one.
So what improvements would you like to see in PL/SQL?
To start ball rolling, I'll suggest a couple and will post onto Steve's site:
1) I miss the ternary operator from other languages such as Java. The ternary operator takes the form:
(
So for a trivial example from Java:
boolean b = (1 <>
The ternary operator is really a short hand CASE or IF-ELSE-END IF statement. The power of the ternary operator is it supports expressions within each component, and expressions within expressions and so on. However the ternary operator is also responsible for some evil looking code because of this ability, so definitely it has its pros and cons.
2) To retrieve a sequence number in PL/SQL, you need to wrap this in an implicit SELECT-INTO statement or similar. What I really want to do is the following short-hand:
v_number := my_seq.nextval;
(and thanks to Justin Cave's response to my question on OTN, turns out this is available in 11g, as published in this AskTom article under the section "It's the little things". Neat!)
3) Assertions are a common feature in many languages beyond simple exception handling. They allow you to test a condition, and if it fails, stop the program. They are ideal for debugging programs because you can (for example) place the assertions at the beginning of each PL/SQL module to ensure incoming parameters are not null.
So what features would you like to see in PL/SQL? Why not head over to Steve Feuerstein's site and record your thoughts.
oracle search
Wednesday, May 7, 2008
What features would you like to see in PL/SQL?
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment