The document contains definitions for several Oracle stored procedures that perform various tasks:
1. The chk_prime procedure checks if a given integer is a prime number and prints the factors if it is not prime.
2. The premium procedure calculates health insurance premiums based on various criteria like health, age, location, and gender.
3. The prdct procedure calculates discounts on products based on the product class and purchase amount.
4. The grade procedure calculates grades based on marks obtained in three subjects and prints the corresponding grade.
5. Several other procedures calculate salaries, print names with prefixes, display student/employee details, and update salaries based on experience.
The document contains definitions for several Oracle stored procedures that perform various tasks:
1. The chk_prime procedure checks if a given integer is a prime number and prints the factors if it is not prime.
2. The premium procedure calculates health insurance premiums based on various criteria like health, age, location, and gender.
3. The prdct procedure calculates discounts on products based on the product class and purchase amount.
4. The grade procedure calculates grades based on marks obtained in three subjects and prints the corresponding grade.
5. Several other procedures calculate salaries, print names with prefixes, display student/employee details, and update salaries based on experience.
The document contains definitions for several Oracle stored procedures that perform various tasks:
1. The chk_prime procedure checks if a given integer is a prime number and prints the factors if it is not prime.
2. The premium procedure calculates health insurance premiums based on various criteria like health, age, location, and gender.
3. The prdct procedure calculates discounts on products based on the product class and purchase amount.
4. The grade procedure calculates grades based on marks obtained in three subjects and prints the corresponding grade.
5. Several other procedures calculate salaries, print names with prefixes, display student/employee details, and update salaries based on experience.
f int:=0; i int; j int; begin for i in 2..n/2 loop if (mod(n,i)=0) then dbms_output.put_line(n||' is not a prime number'); f:=1; for j in 1..n loop if (mod(n,j)=0) then dbms_output.put_line(j); end if; end loop; end if; end loop; if (f=0) then dbms_output.put_line(n||' is a prime number'); end if; end; / 2. create or replace procedure premium(health char, age int, lives char, gender char) as prm int; begin if (health='excellent' and age>=25 and age<=35 and lives='city' and gender='m') then prm:=4000; dbms_output.put_line('Premium is '||prm); else if (health='excellent' and age>=25 and age<=35 and lives='city' and gender='f') then prm:=3000; dbms_output.put_line('Premium is '||prm); else if (health='poor' and age>=25 and age<=35 and lives='village' and gender='m') then prm:=6000; dbms_output.put_line('Premium is '||prm); else dbms_output.put_line('No insurance is insured'); end if; end if; end if; end; / 3. create or replace procedure prdct (class char, amount int) as begin if (class='A') then if (amount>5000) then dbms_output.put_line('discount given is 10%'); end if; else if (class='B') then if (amount>8000) then dbms_output.put_line('discount given is 5%'); end if; else if (amount>=10000) then dbms_output.put_line('discount given is 4%'); end if; end if; end if; end; / 4. create or replace procedure grade(m1 int,m2 int,m3 int) as result int:=(m1+m2+m3)*2/3; begin if (0<=result and result<35) then dbms_output.put_line('F'); else if (35<=result and result<50) then dbms_output.put_line('D'); else if (50<=result and result<65) then dbms_output.put_line('C'); else if (65<=result and result<80) then dbms_output.put_line('B'); else dbms_output.put_line('A'); end if; end if; end if; end if; end; / 5. 6. 7. create or replace procedure sales_person(pc int,cs int) as bs int:=10000; tb int; tc int; gs int; begin tb:= cs*500; tc:=0.02*pc*cs; gs:=bs+tb+tc; dbms_output.put_line('Total bonus'||bs); dbms_output.put_line('Total commission'||tc); dbms_output.put_line('Gross salary'||gs); end; / 8. 9. create or replace procedure prfx as g char(1); a char(1); f char(20); m char(20); l char(20); begin select first_name,middle_name,last_name,age,gender into f,m,l,a,g from person; if g='f' and a>12 then dbms_output.put_line('Ms. '||f||' '||m||' '||l); else if g='f' and a<=12 then dbms_output.put_line('Baby '||f||' '||m||' '||l); else if g='m' and a<=12 then dbms_output.put_line('Master '||f||' '||m||' '||l); else dbms_output.put_line('Mr. '||f||' '||m||' '||l); end if; end if; end if; end; / 10. create or replace procedure dsply as ccc int; cd char(200); ssn int; scc int; sn char(20); bd date; ad date; g char(1); c int; begin select classcode,classdesc into ccc,cd from class; select stdno,classcode,stdname,birthdate,admissiondate,gender,contact into ssn,scc,sn,bd,ad,g,c from stdnt; end; / 11. create or replace procedure emp_details as en char(20); s int; jd date; exp int; ret date; begin select empname,salary,joining_date,round(months_between(sysdate,joining_date)/ 12,0),add_months(birth_date,60*12) into en,s,jd,exp,ret from emp; end; / 12. create or replace procedure details as e_n varchar(20); e_no int; d_no int; s int; b_d date; j_d date; begin select empno,deptno,empname,salary,birth_date,joining_date into e_no,d_no,e_n,s,b_d,j_d from dept natural join emp order by deptname,empname desc; end; / 13. create or replace procedure update_salary as exp int; dt date; sdt date; slr int; nslr float; begin select joining_date into dt from emp; select salary into slr from emp; exp:=round(months_between(sysdate,dt)/12,0); if exp<5 then nslr:=slr*1.05; else if 5<=exp and exp<10 then nslr:=slr*1.08; else if 10<=exp and exp<15 then nslr:=slr*1.1; else nslr:=slr*1.13; end if; end if; end if; update emp set salary=nslr; end; / 14.