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

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

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

Use the same credentials as for the container registry login page in Figure 2-3. If the login succeeds, then copy the docker pull command from the Pull Command for Latest section in the lower right of Figure 2-4. The command is shown here for version 19: docker pull container-registry.oracle.com/database/enterprise:19.3.0.0 Figure 2-4. Oracle container registry page […]

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

Recap of the Basic Docker Workflow – Installation of a Containerized Oracle Database Instance and SQL Developer

Recap of the Basic Docker Workflow Let’s assume you’ve just switched your machine on and you want to do some work with your containerized Oracle Database instance and SQL Developer. The following is the set of steps required along with the necessary commands. Check the running Docker containers and look specifically for the Oracle container […]

Running SQL Developer – Installation of a Containerized Oracle Database Instance and SQL Developer

Running SQL Developer At this point, you can use SQL Developer to interact with the database. If SQL Developer is open, right-click the Oracle connection you created earlier. In the case of Figure 2-9, the connection is called OracleDockerNew. This name is just text, so you can use whatever name you configured for your database. […]

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

Fixing the Pesky PL/SQL Error – Taking SQL Developer for a Drive

Fixing the Pesky PL/SQL Error In the previous chapter, we encountered the error shown in Example 3-1 during the PL/SQL run. Example 3-1. An error is born! Errorreport–ORA–01722: invalid number ORA–06512: at line 15 01722. 00000 –“invalid number” *Cause:Thespecified number wasinvalid.*Action:Specify a validnumber. Let’s look a little more closely at Example 3-1. Notice that there’s an error on line 15. I need to locate that line […]

Installing a PL/SQL Procedure in the Database – Taking SQL Developer for a Drive

Installing a PL/SQL Procedure in the Database I’ve made a small change to the PL/SQL code in the form of adding a PROCEDURE name, as shown in Example 3-2. Example 3-2. Completing the declaration of the PL/SQL procedure CREATE OR REPLACE PROCEDURE update_employees IS   CURSOR c1 is SELECT ename, empno, sal FROM emp         ORDER BY sal DESC;  — start with highest paid employee  my_ename VARCHAR2(10);my_empno NUMBER(4);my_sal  NUMBER(7,2); BEGINOPEN c1; FOR i IN 1..5 LOOPFETCH c1 INTO my_ename, my_empno, my_sal; EXIT WHEN c1%NOTFOUND; /* in case the number requested*//* is more than […]

Executing the PL/SQL Procedure – Taking SQL Developer for a Drive

Executing the PL/SQL Procedure Right-click the UPDATE_EMPLOYEES procedure name in Figure 3-7. This should display the procedure-specific context menu, as shown in Figure 3-8. Notice the options available in relation to managing the PL/SQL procedure, such as: Figure 3-8. Executing PL/SQL in the containerized Oracle Database instance Clearly, this menu provides a lot of power. […]