SUM OF 2 NOS
CREATE or replace procedure p1 is
Declare
a number;
b number;
c number;
Begin
a:=50;
b:=89;
c:=a+b;
dbms_output.put_line('Sum of '||a||' and '||b||' is '||c);
End;
SUM OF 2 NOS
CREATE or replace procedure p1 is
Declare
a number;
b number;
c number;
Begin
a:=50;
b:=89;
c:=a+b;
dbms_output.put_line('Sum of '||a||' and '||b||' is '||c);
End;
DECLARE
CURSOR c1 IS SELECT * FROM emp ORDER BY sal DESC;
e_rec emp%rowtype;
BEGIN
FOR e_rec IN c1
LOOP
DBMS_OUTPUT.PUT_LINE('Number: ' || ' ' || e_rec.empno);
DBMS_OUTPUT.PUT_LINE('Name : ' || ' ' || e_rec.ename);
DBMS_OUTPUT.PUT_LINE('Salary: ' || ' ' || e_rec.sal);
EXIT WHEN c1%ROWCOUNT >= 10;
END LOOP;
END;
DECLARE
CURSOR c1 is SELECT * FROM emp;
str_empno emp.empno%type;
str_ename emp.ename%type;
str_job emp.job%type;
str_mgr emp.mgr%type;
str_hiredate emp.hiredate%type;
str_sal emp.sal%type
str_comm emp.comm%type;
str_deptno emp.deptno%type;
rno number;
BEGIN
rno := &rno;
FOR e_rec IN c1
LOOP
IF c1%rowcount = rno THEN
DBMS_OUTPUT.PUT_LINE (str_empno || ' ' || str_ename || ' '
|| str_job || ' ' || str_mgr || ' ' || str_hiredate || ' ' || str_sal || ' '
|| str_comm || ' ' || str_deptno);
END IF;
END LOOP;
END;