Given the following function definition: create function dbo.MyFunction ( @num1
ID: 3591918 • Letter: G
Question
Given the following function definition:
create function dbo.MyFunction
(
@num1 decimal(16,4),
@code char(1)
) returns decimal(16,4)
as
begin
declare @returnNum decimal(16,4)
if (@code = ‘A’)
begin
set @returnnum = num1 * .50
end
else if (@code = ‘B’)
begin
set @returnnum = num1 * .25
end
else
set @returnnum = num1 – (num1 * .50)
return @returnNum
end
GO
What is the output of the query below? (choose one) (10 pts)
Select dbo.MyFunction(20,’B’) , dbo.MyFunction(30, ‘C’)
Error occurs when query is executed
10, 15
5 ,30
5, 15
Error occurs when query is executed
10, 15
5 ,30
5, 15
Explanation / Answer
Answer) Error occurs when the query is executed.
Explanation:- There is no FROM clause in the given query. The query should be as follows:-
Select dbo.MyFunction(20,’B’) , dbo.MyFunction(30, ‘C’) FROM dual;
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.