PLSQL

PL/SQL Environment

PL/SQL Environment

PL/SQL is not only said to be a standalone programming language, it is also known to be a tool within the oracle programming environment. SQL* plus is known to be an an interactive tool that allows us to type SQL and also PL/SQL statements at once in the command prompt. All these commands are then sent to the database for processing. Once all these statements are processed, all the results are then sent back and then displayed on the screen. 

For running PL/SQL programs, we should have the oracle RDBMS server that is to be installed in our machine. It takes care of all the execution of the SQL commands. The recent version is oracle 11g. we can download a trail version from the following given link below:

https://www.oracle.com/database/technologies/oracle-database-software-downloads.html 

We will have to download either 32-bit or the 64-bit version of the installation as per our operating system. There are two files. We should follow similar steps given below on our operating system that does not matter whether it is Linux or Solaris.

  1. Win64_11Gr2_database_1of2.zip
  2. Win64_11Gr2_database_1of2.zip

After downloading the required files for your operating system. Unzip the files in a single directory database and then under that we find following subdirectories.
Oracle Sub Directries

Step 1:

Launch the oracle database installer by using the setup file given. Below is the first screen. We can also provide our email id and check the given checkbox as show in given below snapshot. Then click the next button.


Oracle Install 1

 Step 2:

We will be directed to the following page given below, uncheck the box and then click the continue button to proceed.


Oracle install error

Step 3:

Select the first button create and configure database using the radio button and click the next button to proceed. 


Oracle Install 2

Step 4:

Select the Desktop class option and then click the next button for proceeding further.


Oracle Install 3

Step 5:

Provide the location, where you will install the oracle server. And then modify the oracle base and also the other locations that will be set automatically. We should also provide a password, that will be used by the system DBA. Once we have provided the required information, click the next button to proceed.


Oracle Install 4

Step 6:

Click the next button to proceed.


Oracle Install 5

Step 7:

Click the finish button to proceed further, this will then start the actual server installation.


Oracle Install 6

Step 8:

It takes few moments, until oracle starts performing the required configuration.


Oracle Install 7

Step 9:

Then the oracle installation will copy the required configuration files, that takes a moment-


Oracle Configuration

Step 10:

Once the database files are copies, then we will have the following Dialogue Box. Then click the OK button and then come out.


Oracle Configuration

Step 11:

After installation, we have the following window which is same like given below snapshot


Oracle Install 8

Final step:

This is the time where we have to verify our installation. At a command prompt, use the following command in case we are using windows-

Sqlplus ”/ as sysdba”


PL/SQL Command Prompt

We should also have the SQL prompt where we can write our PL/SQL commands and also the scripts.

Text Editor

When we run larger programs from the command prompt, we will land in losing some amount of work. It is recommended to use the command files. For using command files 

  1. We should type our code in a text editor like Notepad, Notepad+, or edit plus, etc.
  2. Then save the file with the .SQL extension in the home directory.
  3. Launching the SQL*Plus command from the directory where we can create our PL/SQL file. 
  4. Give @file_name at the SQL*Plus command prompt for executing the program.

In case if we are not using a file for executing all the given PL/SQL scripts, we can simply copy our code and then right-click on the black window that will display the SQL prompt, and then use the paste option for pasting the complete code and finally just press the enter to execute the code, incase if it not executed.