Forum

PLSQL program to di...
 
Notifications
Clear all

PLSQL program to display Welcome Message Total Salary paying to all employees


Hari Priya
Posts: 47
 Hari Priya
Topic starter
(@Hari Priya)
Joined: 1 year ago

Can you help me to write these PLSQL Programs?

1) Write a PLSQL program to display Welcome Message 2) Total Salary paying to all employees and 3)Display employee name salary and designation of specific employee? 

1 Reply
jeevan 123
Posts: 6
(@jeevan303500)
Active Member
Joined: 4 months ago

Hi Hari Priya,

Please find below and let me know your thoughts.

 

  • write a program to display welcome to plsql message?

 

SQL> BEGIN

  2  DBMS_OUTPUT.PUT_LINE('WELCOME TO PLSQL PROGRAMMING');

  3  END;

  4  /

 

PL/SQL procedure successfully completed.

 

SQL> SET SERVEROUTPUT ON;

SQL> /

WELCOME TO PLSQL PROGRAMMING    

                                               

 

PL/SQL procedure successfully completed.

 

  • write a program to display total salary paying to all emps?
SQL>

SQL> DECLARE

  2  VTOTAL  number;

  3  BEGIN

  4  select sum(sal) INTO vtotal

  5  from emp;

  6  dbms_output.put_line(' Total Salary:  ');

  7  dbms_output.put_line(vtotal);

  8  END;

  9  /

Total Salary:                                                                  

29025     

                                                                      

 

PL/SQL procedure successfully completed.

 

SQL> ed

Wrote file afiedt.buf

 

  1  DECLARE

  2  VTOTAL  number;

  3  BEGIN

  4  select sum(sal) INTO vtotal

  5  from emp;

  6  dbms_output.put_line(' Total Salary:  '||vtotal);

  7  --dbms_output.put_line(vtotal);

  8* END;

SQL> /

Total Salary:  29025         

                                                  

 

PL/SQL procedure successfully completed.

 

  • write a program to display empname,sal, desg of emp id 7788?
SQL> DECLARE

  2  vname  varchar2(10);

  3  vsal   number(5);

  4  vdesg  varchar2(10);

  5  BEGIN

  6  select ename,sal,job into vname,vsal,vdesg

  7  from emp

  8  where empno=7788;

  9  dbms_output.put_line(' Empid:  7788');

 10  dbms_output.put_line(' Emp Name:  '||vname);

 11  dbms_output.put_line(' Emp salary:  '||vsal);

 12  dbms_output.put_line(' Working as:  '||vdesg);

 13  end;

 14  /

Empid:  7788                                                                    

Emp Name:  SCOTT                                                               

Emp salary:  3000                                                              

Working as:  ANALYST                                                            

 

PL/SQL procedure successfully completed.

 

SQL> /

Empid:  7788                                                                   

Emp Name:  SCOTT                                                               

Emp salary:  3000                                                               

Working as:  ANALYST                                                           

 

PL/SQL procedure successfully completed.

 

SQL> /

Empid:  7788                                                                    

Emp Name:  SCOTT                                                               

Emp salary:  3000                                                              

Working as:  ANALYST                                                            

 

PL/SQL procedure successfully completed.

 

SQL> spool off;

Reply
Share: