Course recordings on DaDesktop for Training platform
Visit NobleProg websites for related course
Visit outline: ORACLE PL/SQL Fundamentals (Course code: oplsqlfun)
Categories: Oracle PL/SQL · PL/SQL
Summary
Overview
This course session is a hands-on technical training focused on troubleshooting Oracle SQL Developer connectivity issues and introducing basic PL/SQL SELECT statement usage. The trainer guides participants through diagnosing an ORA-12541 error (server not running), correcting hostname mismatches in Oracle configuration files (tnsnames.ora and listener.ora), restarting systems to apply changes, and then transitioning into PL/SQL data retrieval patterns. The session combines live debugging, configuration editing, and foundational PL/SQL syntax instruction.
Topic (Timeline)
1. Connectivity Setup and Troubleshooting [00:00:10 - 00:09:44]
- Trainer verifies all participants have access to their desktops and Oracle SQL Developer installed (shortcut provided).
- Participants confirm access; some experience issues with incorrect interfaces (e.g., Command Prompt instead of SQL Developer).
- Trainer instructs participants to use “local” connection and enter password:
ashblue. - Participant “Jerry” encounters ORA-12541 error: “TNS:listener does not currently know of service requested in connect descriptor.”
- Trainer guides Jerry to:
- Open terminal and run
hostnameto identify system name:jeremias-93dn. - Navigate to Oracle configuration folder and open
tnsnames.orain Visual Studio Code. - Replace all instances of
ray-lhnw-resizewithjeremias-93dn. - Save changes using
Ctrl+S.
- Open terminal and run
- Trainer then guides Jerry to edit
listener.orausing the same method, ensuring hostname consistency. - Trainer shares a Google Sheet link containing commands to start the Oracle listener service.
- Participants are instructed to run
lsnrctl startin terminal to initiate the listener. - Trainer notes that after hostname changes, a system restart is required for changes to take effect.
- All participants with similar errors are advised to restart their computers.
2. PL/SQL SELECT Statement Fundamentals [00:09:53 - 00:12:04]
- While participants restart their systems, trainer shifts to theoretical instruction on PL/SQL.
- Explains that the
SELECTstatement in PL/SQL retrieves data from database tables and can be used in two contexts:- Standard SQL:
SELECT column FROM table; - PL/SQL block: Requires
DECLARE,BEGIN, andENDstructure.
- Standard SQL:
- Describes variable declaration within
DECLAREsection, data retrieval inBEGIN, and output handling. - Mentions handling exceptions such as
NO_DATA_FOUNDandTOO_MANY_ROWS(implied by “no data found or too many errors”). - Indicates intent to demonstrate practical examples but pauses due to ongoing restarts.
Appendix
Key Principles
- Hostname Consistency: Oracle client configuration files (
tnsnames.ora,listener.ora) must match the system’s actual hostname. - Listener Control: Use
lsnrctl startto manually start the Oracle listener service after configuration changes. - System Restart Required: Changes to Oracle network configuration files require a full system reboot to be recognized.
- PL/SQL Structure: Always use
DECLARE(variables),BEGIN(logic/query), andEND;(block termination) for procedural SQL.
Tools Used
- Oracle SQL Developer
- Command Prompt (Windows)
- Visual Studio Code (for editing
.orafiles) - Google Sheet (for sharing commands)
Common Pitfalls
- Opening Command Prompt instead of SQL Developer.
- Using incorrect hostname in configuration files (e.g., mismatched server name).
- Forgetting to restart system after editing
tnsnames.oraorlistener.ora. - Not verifying connection status before attempting queries.
Practice Suggestions
- Manually edit
tnsnames.oraandlistener.oraon a local Oracle instance using correct hostname. - Practice writing PL/SQL blocks that use
SELECT INTOwith variable declarations. - Simulate
NO_DATA_FOUNDandTOO_MANY_ROWSexceptions using sample queries with restrictive WHERE clauses.