Command Palette
Search for a command to run...
Comments
Join the discussionNo comments yet. Be the first to comment.
More from this blog
Display salary and ename using cursor
declare cursor c1 is select * from emp; e emp %rowtype; begin open c1; loop fetch c1 into e; exit when c1 %notfound; dbms_output.put_line(e.ename || ' ' || e.sal); end loop; dbms_output.put_line('No of records fetched ' || c1 %rowcount); close c1; e...
wap for NO_DATA_FOUND Exception
DECLARE vno NUMBER(5) := :vno; vname emp.ename%TYPE; BEGIN SELECT ename INTO vname FROM emp WHERE empno = vno; DBMS_OUTPUT.PUT_LINE(vno || ' ' || vname); EXCEPTION WHEN NO_DATA_FOUND THEN DBMS_OUTPUT.PUT_LINE('NO data in table'); WHEN OTHERS ...
wap for assign bounds based on job and salary
declare cursor c1 is select * from emp; e emp %rowtype; net number(10); bonus number(10); begin open c1; loop fetch c1 into e; exit when c1 %notfound; net:= e.sal+nvl(e.comm,0); if(e.job='CLERK' and net>1000) then bonus:=800; elsif(e.job='SALESMAN' ...
Write a function to return net salary of a given employee
CREATE OR REPLACE FUNCTION net_sal(vno NUMBER) RETURN NUMBER IS vsal emp.sal%TYPE; vcomm emp.comm%TYPE; net NUMBER(10); BEGIN SELECT sal, comm INTO vsal, vcomm FROM emp WHERE empno = vno; net := vsal + NVL(vcomm, 0); RETURN(net); END; for out...
WAP to display all managers data from emp table using cursor for loop
DECLARE CURSOR c1 IS SELECT * FROM emp WHERE job = 'MANAGER'; BEGIN DBMS_OUTPUT.ENABLE; FOR i IN c1 LOOP DBMS_OUTPUT.PUT_LINE(i.empno || ' ' || i.ename || ' ' || i.sal); END LOOP; END;
spy DBMS
10 posts