SET 2 : 1 Hour
1.examine the data of the EMPLOYEE table
empno ename comm
10 Ramu 200
20 Martin
30 scott 300
40 james
50 king 0
write a query to display following output?
empno ename comm
10 Ramu Available
20 Martin Not available
30 scott Available
40 james Not available
50 king Available
2. You need to create a view EMP_VU . The view should allow the users to manipulate the records of
only the employees
that are working for departments 10 or 20. write a sql statement would you use to create the view
EMP_VU?
3.examine the structure of the STUDENTS table
STUDENT_ID NUMBER NOT NULL, PRIAMRY KEY
STUDENT_NAME VARCAHR2(30)
COURSE_ID VARCAHR2(10) NOT NULL
MARKS NUMBER
START_DATE DATE
FINISH_DATE DATE
you need to create a report of the 10 students who achieved the highest ranking in the course
INTSQL and who completed the course
in the year 1999. write a sql query to accomplish this task?
SET 2 : 1 Hour
4.Evaluate the following pl/sql block?
SET SERVEROUTPUT ON
DECLARE
v_result VARCHAR2(5):='SAMPLE';
BEGIN
dbms_output.put_line(v_result);
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line('some error occured while processing.');
END;
/
what will be the output?
5.Examine the data of the EMPLOYEE table
DEPTNO SAL
10 1000
20 2000
30 1500
20 400
10 500
30 700
Write a query to display following output?
DEPTNO SAL
1 1500
2 2400
3 2200
6. How to execute a function that is defined in a package using Oracle/PLSQL?
7. How to insert '03-may-11 21:02:44' date into the column "last_date" of table "ABC".
SET 2 : 1 Hour
8. What is the output of the below block. ?
DECLARE
BEGIN
FOR i IN 1..10 LOOP
DECLARE
my_execp EXCEPTION;
BEGIN
IF(I = 5) THEN
RAISE my_execp;
ELSE
DBMS_OUTPUT.PUT_LINE('updated');
END IF;
EXCEPTION
WHEN my_execp THEN
dbms_output.put_line('not-update');
END;
END LOOP;
END;
9. What is the result of the below query.
SELECT SUBSTR('Banglore, Ban glo', INSTR('Banglore, B ang',', ')+2) FROM dual;
10. Cosider the procedure CallProc1 is created.
CREATE OR REPLACE PROCEDURE CallProc1(p1 IN VARCHAR2 := NULL) AS
BEGIN
DBMS_OUTPUT.PUT_LINE('CallProc1 called with ' || p1);
END CallProc1;
/
What is the result of the below block.?
DECLARE
myResult VARCHAR2(50);
BEGIN
EXECUTE IMMEDIATE 'CALL CallProc1(''Hello from PL/SQL'')';
EXECUTE IMMEDIATE 'CALL CallFunc(''Hello from PL/SQL'') INTO :myResult'
USING OUT myResult;
END;
/
SET 2 : 1 Hour