Oracle PL/SQL - Questions and Answers 1. Write a program that displays the Netsal(Sal+comm) of an employee entered at run time from EMP table.(Use NVL Function). DECLARE NETSAL NUMBER; BEGIN SELECT NVL(SAL + COMM, SAL) INTO NETSAL FROM EMP WHERE EMPNO = & EMPNO1; DBMS_OUTPUT . PUT_LINE(NETSAL); END ; 2. Write a program that will prompt for a EMPNO,ENAME,SAL. If EMPNO does not exists in EMP table then INSERT the EMPNO,ENAME,SAL into the EMP table else UPDATE ENAME,SAL for that EMPNO. DECLARE EMPNO1 NUMBER; ENAME1 VARCHAR2( 50 ); SAL1 NUMBER; EMPNO_VAL BOOLEAN ; NUM NUMBER; BEGIN EMPNO1 := & EMPNO; ENAME1 := '&ENAME' ; SAL1 := & SAL; SELECT EMPNO INTO NUM FROM EMP WHERE EMPNO = EMPNO1; IF NUM IS NOT NULL THEN UPDATE EMP SET ENAME = ENAME1, SAL = SAL1 WHERE E
- Get link
- Other Apps