Vous êtes sur la page 1sur 3

1 Create function dept count(dept_name varchar(20))

begin
declare d count integer;
select count(*) into d count
from instructor
where instructor.dept_name= dept_name
return d count;
end
Find the error in the the above statement .
a) Return type missing
b) Dept_name is mismatched
c) Reference relation is not mentioned
d) All of the mentioned
Ans: a
2 A stored procedure in SQL is a___________
a) Block of functions
b) Group of Transact-SQL statements compiled into a single execution plan.
c) Group of distinct SQL statements.
d) None of the mentioned
Ans: b
3 Which is a database object that groups logically related PL/SQL types, objects and subprograms?
a. Package
b. Module
c. Body
d. Name
Ans: a
4 To call a subprogram directly, users must have the EXECUTE privilege on that subprogram. By
granting the privilege, you allow a user to –
a. Call the subprogram directly
b. Compile functions and procedures that call the subprogram
c. Both A & B
d. None of the above
Ans: c
5 Which of the following combines the data manipulating power of SQL with the data processing
power of Procedural languages?
a. PQL
b. Advanced SQL
c. PL/SQL
d. SQL
Ans: c

6 Write a dynamic program for insert student details like student id, name, class, age, ph no.
Declare
Declare

Stu_id varchar(20) := :enter_id;

Name varchar(20) := :enter_name;

Class int := :enter_class_no;

Age int := :enter_age;

Ph_no int :=:enter_mobileno;

begin

insert into student values(Stu_id, Name, Class, Age, Ph_no);

end;

7 Write a dynamic procedure to find the biggest number between 4 numbers.


create procedure biggest_Num(a int, b int, c int, d int)

is

type numlist is varray(4) of number;

num numlist;

n number := 0;

begin

num := numlist(a,b,c,d);

for i in 1 .. 4 LOOP

if n<num(i) then

n:=num(i);

end if;

end LOOP;
dbms_output.put_line('Biggest number is '||n);

end;

begin

biggest_Num(7,21,42,32);

end;

Vous aimerez peut-être aussi