Skip to main content

Posts

Feedback on my Planning for Trouble Oracle Magazine article

Received feedback today from James S on my latest Oracle Magazine article, Planning for Trouble . I will respond here (there is no mechanism for comments/discussion at the Oracle Magazine page). If you haven't yet read it, I suggest you do so before proceeding with this post. Comment 1.  This is regarding exception handling.  Let’s say the client calls procedure A, and A calls B, B calls C.  Are you suggesting we add a “When others” + error logging logic in each level? Does it mean one error will be logged three times? (because it is captured and re-raised each time). Good point, James. I make the argument in the article that you should trap the exception as close as possible to where it was raised, so that you can log  the  values of local variables that may help you diagnose the problem.  [Here's reinforcement of that point (and other great points about doing effective execution tracing) - they call it contextual logging:  http://www.stack...

Planning for trouble: comments on my latest Oracle Magazine article.

In my November/December 2014 article for Oracle Magazine, Planning for Trouble , I urge developers to realize that regardless of best intentions, not everything related to our apps is under our control, and we need to assume that trouble might be coming our way. I received today, the following comments from Gary Malandro, which I thought you might enjoy reading: Enjoyed your article in Oracle Magazine, and I have a few comments. 1.         You mentioned “Documents that spell out naming conventions…fit very nicely inside desk drawers”.  On our team, we have a number of policies that include the requirements for a technical design document, a software change request, source control, and some regarding style.  First thought upon hearing that is probably what-a-load-of-bureaucratic-nonsense.  Well, there are reasons for creating and enforcing these standards.  Compliance for one.  Another is we had code going into producti...

FORALLs and COMMITs

Received this note today from Debbie B: I attended your Turbo Charge PL/SQL seminar today. I still have a question about where to put COMMIT. I’m using 10g. See (pseudo) code below. Say I have 50,000 records and the LIMIT is 100. If an exception is thrown: Do I need a COMMIT in the WHEN clauses so successful DML gets committed, then loop processing will continue? I  was thinking each DML needed it’s own BEGIN EXCEPTION END block so I would know if the error happened due to the insert or the update and could log the appropriate error. Is this wrong?   OPEN v_cursor;   LOOP     FETCH v_cursor BULK COLLECT INTO data_array LIMIT i_limit;     EXIT WHEN data_array.COUNT = 0;     BEGIN       FORALL i IN 1.. data_array.COUNT SAVE EXCEPTIONS         INSERT INTO some_table VALUES data_array (i);         COMMIT; ...

Dinodate, PL/SQL as Scripting Language Liberator, watch the show!

As I mentioned in a previous post , I had an awful lot of fun with Christopher Jones doing our PL/SQL: The Scripting Language Liberator talk at OOW. PL/SQL: The Scripting Language Liberator : While scripting languages go in and out of favor, Oracle Database and PL/SQL persist, managing data and implementing business logic. This session walks through a web application to show how PL/SQL can be integrated for better logic encapsulation and performance; how Oracle's supplied packages can be used to enhance application functionality and reduce application complexity; and how to efficiently use scripting language connection and statement handling features to get better performance and scalability. Techniques shown in this session are applicable to mobile, web, or midtier applications written in languages such as JavaScript, Python, PHP, Perl, or Ruby on Rails. Using the right tool for the right job can be liberating. Once word got out around Oracle that we would be unveiling Di...

Running out of PGA memory with MULTISET ops? Watch out for DISTINCT!

A PL/SQL team inside Oracle made excellent use of nested tables and MULTISET operators in SQL, blending data in tables with procedurally-generated datasets (nested tables).  All was going well when they hit the dreaded: ORA-04030: out of process memory when trying to allocate 2032 bytes  They asked for my help.  The error occurred on this SELECT: SELECT  *    FROM header_tab trx    WHERE (generated_ntab1 SUBMULTISET OF trx.column_ntab)       AND ((trx.column_ntab MULTISET             EXCEPT DISTINCT generated_ntab2) IS EMPTY) The problem is clearly related to the use of those nested tables. Now, there was clearly sufficient PGA for the nested tables themselves. So the problem was in executing the MULTISET-related functionality. We talked for a bit about dropping the use of nested tables and instead doing everything in SQL, to avoid the PGA error. That would, however require lots of wo...

The PL/SQL Whisperer

[oreiginally published at FeuerThoughts in December 2011] I spent two days in Berlin, training 25 developers at an event sponsored by  DOAG . Then I headed over to the Netherlands to spend a couple of days with 37 developers at an  AMIS -sponsored training. But on Tuesday, after I completed the first day of training without the assistance of a microphone, my voice said "Bye, bye!" I woke up Wednesday morning to discover I had lost the ability to speak above a whisper . DOAG hustled, did what was necessary, and brought in a portable microphone/speaker system. AMIS made certain to have the same ready to go on Thursday.  And so for three straight days, I  whispered  about new features of PL/SQL in 11g and much more besides. The attendees were very good natured about this less than optimal situation. One person said it made the whole class more exciting - it was as though I was giving away secrets, that no one should hear- except for the very special people in at...

My Ninth OOW - and first as an Oracle employee

Before heading out to San Fran last Thursday for meetings and the ACE Director briefing, I happened to pick up my Oracle PL/SQL Advanced Programming with Packages (my second book, published in 1996, immediately following up from the 1995 publication of my Oracle PL/SQL Programming text at IOUW in Phillie).  Here’s what I found taped inside the cover: That was the first Oracle Open World ever, and I was still working for SSC, the consulting firm I joined when I left Oracle in 1992. Must confess: don’t remember anything about OOW96, but I know how to count. Here’s some OOW math: I have attended OOW96, 97, 98, 99 2000….2014: nine Oracle Open Worlds. During that time I published nine books on PL/SQL and one (with primary author Guy Harrison) on MySQL Stored Procedures; I wrote one or two automated testing frameworks for PL/SQL, and racked up 2M miles on American Airlines - ignoring my family as I traversed a sizeable chunk of human-occupied Earth presenting on PL/S...