There Is a Better Way 3 – Resilient Software and PL/SQL

Example 1-2 illustrates a slightly different style of writing PL/SQL, which might be more familiar to developers used to mainstream languages. Again, some comments (which start with the characters “–”) are added to help in understanding it. As before, try to figure out what the code is doing before reading on. Example 1-2. A more […]

There Is a Better Way 2 – Resilient Software and PL/SQL

The code in Example 1-1 loops from 1 to 20 and checks if the numbers are even or odd. The latter is done using the MOD function and the result is written into a table called temp. A cursory glance at the listing allows us to figure most of this out. Some confusion might also […]

There Is a Better Way – Resilient Software and PL/SQL

There Is a Better Way Learning PL/SQL is not so difficult. With a little effort and a willingness to expand your programming tool set, PL/SQL skills can be acquired with relative ease. In fact, quickly learning new programming languages is a key skill for all developers. It’s also an interesting challenge and helps make for […]

Cursors – Resilient Software and PL/SQL

Cursors Armed with the knowledge from the previous examples, let’s look at Example 1-3, where you can begin to see more of the power of PL/SQL. Just to keep it interesting, I’ve reverted again to uppercase. Try not to be intimidated by any content you haven’t seen before. Example 1-3. More powerful PL/SQL DECLARECURSORc1isSELECTename,empno,salFROMempORDERBYsalDESC;— start […]

Implicit CURSORs – Resilient Software and PL/SQL

Implicit CURSORs When Oracle executes a SQL statement using SELECT, UPDATE, etc., it automatically creates an implicit CURSOR. This CURSOR is managed internally and Oracle reveals only a limited amount of information about it. For example, you can get the numbers of rows affected by the query using the following command: SQL%ROWCOUNT If you want […]

Understanding the Need for a PL/SQL Learning and Development Environment – Resilient Software and PL/SQL

Understanding the Need for a PL/SQL Learning and Development Environment As with other programming languages, PL/SQL code should be written and maintained using some sort of software tool. The tool I’ll be using in the book is the venerable SQL Developer from Oracle, which has many powerful features. SQL Developer will be introduced in the […]

Capture All Errors and Exceptions: Score = 0 – Resilient Software and PL/SQL

Capture All Errors and Exceptions: Score = 0 We get a big 0 for this one, and deservedly so. The code in Example 1-4 doesn’t handle any errors or exceptions. This is perhaps the single greatest problem with this code. It can fail, and when it does, we’ll have little or no idea as to […]

Reusability: Score = 2 – Resilient Software and PL/SQL

Reusability: Score = 2 Because the Example 1-4 code isn’t structured as a procedure or function, it’s not easily reusable. One of the merits of writing reusable code is that you must aim for more generality in terms of structure, parameter names, and so on. So rather than just solving the problem at hand, your […]

A Virtualized Oracle Database Installation – Installation of a Containerized Oracle Database Instance and SQL Developer

A Virtualized Oracle Database Installation Rather than just doing a native installation of Oracle Database onto your machine, I instead opt to use a virtualized approach. This has many merits, not the least of which is the educational benefit. It’s a good thing to come to grips with containers and images because they represent what […]

Getting Started with Docker 3 – Installation of a Containerized Oracle Database Instance and SQL Developer

Example 2-3. Checking the log for the container again Prepare fordboperation8%completeCopyingdatabasefiles31%completeCreatingandstartingOracleinstance 32%complete 36%complete 40%complete 43%complete 46%completeCompletingDatabaseCreation When the container creation is complete, you should see log content similar to Example 2-4. Example 2-4. Checking the log for the container one last time ALTERSYSTEMSETlocal_listener=”SCOPE=BOTH;ALTERPLUGGABLEDATABASEORCLPDB1SAVESTATECompleted:ALTERPLUGGABLEDATABASEORCLPDB1SAVESTATE 2022–12–30T19:28:54.854962+00:00XDB initialized.2022–12–30T19:37:53.816824+00:00 ORCLPDB1(3):Resize operation completed for file# 10, old size 337920K,newsize348160K If the log looks like the text […]