Write a PL / SQL to insert ,update and delete in a table. - Computer Programming

Latest

C C++ Java Python Perl Programs Examples with Output -useful for Schools & College Students

Friday, September 29, 2017

Write a PL / SQL to insert ,update and delete in a table.

SQL PROGRAM FOR  INSERT , UPDATE AND DELETE IN A TABLE

PROGRAM:
DECLARE   
v_sal emp.sal%TYPE;
BEGIN   
INSERT INTO emp VALUES (6, 'Tomcat', 1000);  
UPDATE emp SET sal = sal + 5000 WHERE empno = 6;    
SELECT sal INTO v_sal FROM employee WHERE empno = 6;   
DBMS_OUTPUT.PUT_LINE('Salary increased to ' || v_sal);   
DELETE FROM emp WHERE empno = 6;     
COMMIT;
END;

No comments:

Post a Comment