Database Module 4 5
Database Module 4 5
Subprograms are named PL/SQL blocks that are What is missing in the given code below?
compiled and stored in the ____. - DATABASE CREATE or replace procedure raise_sal
empid my_employees.employee_id%TYPE := 1234,
emp_raise number IS
In anonymous block, DECLARE states “this is the BEGIN
start of a block”. In Procedure, ___ states “this is update employees
set salary = salary + (salary * (emp_raise/100) where employee_id =
the start of a subprogram”. - CREATE
emp;
PROCEDURE END;
The code below is a correct example of passing Which can be used to assign a default value to IN
parameters by combination notation. - False parameters?
add_dept (p_loc=>1400, ‘EDUCATION’ ); ● :=
Correct: add_dept ('EDUCATION', p_loc=>1400); ● DEFAULT
● Assignment operator
If combination notation is used, the positional ● All the options
parameters must come first before the named
parameters. - True How many parameters are there in the given code?
CREATE or replace procedure raise_sal
The formal parameters can be literal values, empid my_employees.employee_id%TYPE := 1234,
emp_raise number IS
variables, or expressions that are sent to the BEGIN
parameter list of a called subprogram. - False update employees
(actual parameters) set salary = salary + (salary * (emp_raise/100) where employee_id =
emp;
END;
The positional parameter passing uses the
associate operator - False ● 1
● 0
The positional parameter passing is the common ● 2
method of passing parameters – True ● 3
This study source was downloaded by 100000848084631 from CourseHero.com on 06-21-2022 00:50:37 GMT -05:00
https://www.coursehero.com/file/129616780/DATABASE-MODULE-4-5docx/
Given the procedure below, what is the correct way In the given Procedure header, the underlined
of invoking the procedure? clause/keyword is optional
CREATE OR REPLACE PROCEDURE show_emps CREATE OR REPLACE PROCEDURE name
(p_emp_id IN NUMBER, p_department_id IN number,
p_hiredate IN DATE) IS [parameters] IS|AS - True
BEGIN
...
The DEFAULT keyword is used to assign a default
END;
● show_emps(p_department_id => 10, p_hiredate => ‘01-dec- value for formal parameters - True
1007’, p_emp_id => 101)
● show_emps(101, 10, ‘01-dec-2006’);
● show_emps(101, p_hiredate => ‘01-dec-2007’,
● Usually, you can use named notation to
p_department_id = 10) override the default values of formal
● All the options parameters./
● You can set a default value of a formal
In stored function, the ___ clause is used instead of parameter by including the DEFAULT clause
OUT mode. - RETURN or using the assignment operator (:=) in the
CREATE PROCEDURE or CREATE
The functions used in SQL statements cannot use FUNCTION statement.
OUT or ___ modes. - IN OUT
What is missing in the given code below?
CREATE or replace procedure raise_sal
Which of the statement below is valid? Assuming (empid my_employees.employee_id%TYPE := 1234,
emp_raise number)
that get_sal function exists with parameter. BEGIN
● get_sal + 50; update employees
set salary = salary + (salary * (emp_raise/100) where employee_id =
● not in the options
emp;
● v_salary := get_sal() + 50; END;
● get_sal() + 50; ● Procedure name after END keyword
● Not in the options (IS)
A function is called as part of an expression ● Nothing is missing
(example): ● IN
promotable := sal_ok(new_sal, new_title) AND (rating
● Incomplete declaration of emp_raise
> 3);
parameter
The executable section of the procedure body In stored function, the parameter mode should only
requires a minimum of ___ statement - one be __ - IN
This study source was downloaded by 100000848084631 from CourseHero.com on 06-21-2022 00:50:37 GMT -05:00
https://www.coursehero.com/file/129616780/DATABASE-MODULE-4-5docx/
What is missing in the code below?
create or replace function sample
return number
is num number(2);
begin
num:=5+5;
end;
● Incomplete expression
● No return value
● Formal parameter
● Size of the returning value
This study source was downloaded by 100000848084631 from CourseHero.com on 06-21-2022 00:50:37 GMT -05:00
https://www.coursehero.com/file/129616780/DATABASE-MODULE-4-5docx/
Powered by TCPDF (www.tcpdf.org)