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 […]
Category: Running SQL Developer
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 […]
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 – 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 […]
Updating the User Password – Installation of a Containerized Oracle Database Instance and SQL Developer
Updating the User Password There may come a point in the future where you will need to change your Oracle Database password. For example, if you don’t use the Docker image for a long time, the user password may expire. If this happens, then it’s simple enough to update the password using a very similar […]
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 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 […]
Another Alternative to the Command-Line Use of Docker – Installation of a Containerized Oracle Database Instance and SQL Developer
Another Alternative to the Command-Line Use of Docker Docker Desktop also provides some pretty decent container management features. In Figure 2-16 you see the container listing, which comprises the Oracle Database container. In Figure 2-16, you can also look at the container image by clicking the Images option, as shown in Figure 2-17. As the […]
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 2 – Taking SQL Developer for a Drive
The idea of shift-left has become increasingly popular as teams face pressure to deliver software more frequently and with higher quality. Shift-left potentially speeds up development efficiency and helps reduce costs by detecting and addressing software defects as early as possible in the development cycle, ideally long before such defects get to production. “Fixing the […]