1600 PMP mock questions 1400 CAPM mock questions 800 SCJP 6 mock questions 600 OCAJP 7 mock questions 590 OCPJP 7 mock questions 556 SCWCD 5 mock questions 500 OCEJWCD 6 mock questions pdfDownload (java,struts, hibernet etc)

ORACLE Tutorials

Simple PROGRAM IN PL/SQL using DBMS_OUTPUT

Simple PROGRAM IN PL/SQL using DBMS_OUTPUT

This supplied package is an essential tool to debug the program written. So, use this and write your first program. This package prints the output of the program on to the screen.

You will read about many important supplied packages as you go forward.

Type the following at the SQL*Plus prompt.

set serveroutput on size 100000

This set command enables you to see the output on the screen up to 100000 characters.

-- this begin command starts the PLSQL block
Begin
-- this is the command to be executed by PLSQL after due validation
Dbms_output.put_line(?Hello Guys .. I am now here, at the door steps of PLSQL. This is my first Program?);
-- this is to close the PLSQL Program
End;
-- this is to run the program
/


REM and # are to be used with Oracle SQL Plus client software to add comments. But can not be used with Oracle PLSQL engine. It can not understand this and spits errors and garbage.

Look at that out put.

SQL> -- this begin command starts the PLSQL block
SQL> Begin
2 -- this is the command to be executed by PLSQL after due validation
3 Dbms_output.put_line('Hello Guys .. I am now here, at the door steps of PLSQL. This is my first Program');
4 -- this is to close the PLSQL Program
5 End;
6 -- this is to run the program
7 /
Hello Guys .. I am now here, at the door steps of PLSQL. This is my first
Program

PL/SQL procedure successfully completed.

SQL>

Here is another program that lets you use loop.


Begin
-- start the loop
For I in 1..5 loop
-- print the output
DBMS_OUTPUT.PUT_LINE(I);
-- close the loop
END LOOP;
END;
/
SQL> Begin
2 -- start the loop
3 For I in 1..5 loop
4 -- print the output
5 DBMS_OUTPUT.PUT_LINE(I);
6 -- close the loop
7 END LOOP;
8 END;
9 /
1
2
3
4
5

PL/SQL procedure successfully completed.

SQL>

That is a great feeling. You have written programs. They are useful to you in many ways in your future programming skills.

Reviews and Comments


PMP, CAPM, PMI is a registered certification mark of the Project Management Institute, Inc

Copyright © www.techfaq360.com 2016


About US | Contact US | Privacy Policy | Terms and Conditions  | Website disclaimer  | Cancellation and Refund Policy  | Shipping & Delivery Policy