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 – 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 […]

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 […]

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

Getting Started with Docker The very first step is to install Docker on your local machine. It’s relatively straightforward to download and install Docker if it isn’t installed already. To install Docker Desktop on Windows, click the Docker Desktop for Windows button. Once the download is complete, remember to do your usual checks: “Verifying Downloaded […]

Configuring Your Oracle Database – Installation of a Containerized Oracle Database Instance and SQL Developer

Configuring Your Oracle Database In order to get the containerized Oracle Database instance to work with SQL Developer, you now need to make a few changes to the configuration. Run the following (rather complicated-looking) command to modify your database. As usual, please ensure that you supply the container ID that matches your own setup: docker exec –it <container_id> bash \–c “source […]

Updating the User Password 2 – Installation of a Containerized Oracle Database Instance and SQL Developer

The next step is to extract the zipped file and follow the installation steps on the website. Let’s now finally configure SQL Developer to use our Docker-containerized Oracle Database. Launch the newly installed SQL Developer application and click the plus sign at the top left of the main window shown in Figure 2-5. Figure 2-5. […]

Running Some PL/SQL Code – Installation of a Containerized Oracle Database Instance and SQL Developer

Running Some PL/SQL Code Let’s now review one of the earlier PL/SQL examples, as shown in Example 2-8. Example 2-8. Cursor use in PL/SQL DECLARECURSOR c1 isSELECT ename,empno,salFROMemp         ORDER BY sal DESC;— start with highest paid employeemy_ename VARCHAR2(10);my_empno NUMBER(4);my_sal  NUMBER(7,2); BEGINOPEN c1;   FOR i IN 1..5 LOOPFETCH c1 INTOmy_ename,my_empno,my_sal;EXIT WHEN c1%NOTFOUND; /* in case the number requested *//* is more than the total       *//* number of employees          */ INSERTINTOtempVALUES(my_sal,my_empno, my_ename);COMMIT;END LOOP;CLOSE c1;END; To run the code in […]

Three Docker Gotchas – Installation of a Containerized Oracle Database Instance and SQL Developer

Three Docker Gotchas As we’re on the topic of errors, when you’re using Docker commands, make sure not to enter the wrong parameter string. 1. Docker Case-Sensitivity For example, here in Example 2-10, the user incorrectly supplies an uppercase letter in the Container parameter. Example 2-10. Docker is case-sensitive C:\Users\Stephen>docker Container ls -aunknown shorthand flag: […]

An Alternative to the Command-Line Use of Docker – Installation of a Containerized Oracle Database Instance and SQL Developer

An Alternative to the Command-Line Use of Docker The Docker-based setup we’re using has a number of merits. One is that it’s quite quick to get it working and it requires a minimal amount of installed software. I mentioned that there are a range of options to choose from if using Docker from the command […]