Compiling and Executing Simple Program


At your command prompt, use the following command if you are using Windows:

   sqlplus "/ as sysdba"

If everything is fine, you should have SQL prompt where you will write your PL/SQL commands and scripts:






















Run Command FilesRunning large programs from command prompt not a better option so it is a better option to use command files.

  • Type your code in a text editor, like Notepad, Notepad+ etc.
  • Save the file with the .sql extension in the home directory.
  • Launch SQL*Plus command prompt from the directory where you created your PL/SQL file.
  • Type @file_name at the SQL*Plus command prompt to execute your program.






















Your First Program






















Note: The end; line signals the end of the PL/SQL block. To run the code from SQL command line, you may need to type / at the beginning of the first blank line after the last line of the code.
The slash character must be typed on a line by itself, and it must be the first character on that line; otherwise, it will get sent to the database and generate an error message.






No comments: