0% found this document useful (0 votes)
18 views

Cursor

The document declares variables to store employee number, name, and net salary. It then opens a cursor to select employee data from the sal5477 table, including calculations for net salary. In a loop, it fetches the cursor data and prints the employee number, name, and net salary.

Uploaded by

Safiya Begum
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

Cursor

The document declares variables to store employee number, name, and net salary. It then opens a cursor to select employee data from the sal5477 table, including calculations for net salary. In a loop, it fetches the cursor data and prints the employee number, name, and net salary.

Uploaded by

Safiya Begum
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

PROGRAM:declare e_no number(6); e_name varchar(20); net_salary number(8,2); cursor cur_sal5477 is select emp_no,emp_name,basic+(da_percent*basic/100)+ma+other_allowances-deduction from sal5477; begin dbms_output.

put_line('Emp_no'||'Name'||'Net Salary'); dbms_output.put_line('---------------------------------'); open cur_sal5477; loop fetch cur_sal5477 into e_no,e_name,net_salary; exit when cur_sal5477 %notfound; dbms_output.put_line(rpad(e_no,10,'')||rpad(e_name,25,'')||net_salary); end loop; close cur_sal5477; end;

GIRI TUNGALA VM 5804

OUTPUT:Emp_no Name Net Salary ------------ -------- ------------1 2 3 Vijay Rahul Priya 7649.25 6549.25 5200

GIRI TUNGALA VM 5804

Function create or replace function fact5477 (n number) return number is i number; f number; begin f:=1; for i in 1..n loop f:=f*i; end loop; return f; end;

GIRI TUNGALA VM 5804

You might also like