Which statement is true about the outcome of the above code?

You create the following table and execute the following code:
(Exhibit)

Which statement is true about the outcome of the above code?

You create the following table and execute the following code:

Which statement is true about the outcome of the above code?

A.
It executes successfully and all the rows are updated.

B.
It gives an error but saves the inserted rows and the update to the first row.

C.
It gives an error but saves the inserted rows; however, no rows are updated.

D.
It gives an error and all the data manipulation language (DML) statements are rolled back



Leave a Reply 13

Your email address will not be published. Required fields are marked *


vins

vins

The second UPDATE raises an exception. An exception handler handles the exception, displaying the error message and committing the change made by the first UPDATE statement. The third UPDATE statement never runs.

Result:
Problem in the FORALL statement.

Divya Tanwani

Divya Tanwani

A is the answer

Vipin

Vipin

Answer B is correct. second update raises exception because value length exceeds the column length.

MANJUSHA

MANJUSHA

Ans: B
explanation

SQL> create table emp_temp(deptno number(2), job varchar2(18));

Table created

SQL> set serveroutput on;
SQL>
SQL> declare
2 type NumList IS TABLE OF NUMBER;
3 depts NumList := NumList(10,20,30);
4 Begin
5 insert into emp_temp values (10,’Clerk’);
6 insert into emp_temp values (20,’Bookkeeper’);
7 insert into emp_temp values (30,’Analyst’);
8 forall j in depts.First .. depts.last
9 update emp_temp set job=job||’ (senior)’
10 where deptno=depts(j);
11 exception
12 when others then
13 dbms_output.put_line(‘problems in the forall statement’);
14 commit;
15 end;
16 /

problems in the forall statement

PL/SQL procedure successfully completed

SQL> select * from emp_temp;

DEPTNO JOB
—— ——————
10 Clerk (senior)
20 Bookkeeper
30 Analyst

SQL>

Kuki

Kuki

i agree, it should be b:
length(‘Bookkeeper’|| ‘ (Senior)’) > varchar2(18)

Afraz Khan

Afraz Khan

Answer B is correct because the value length is exceeded for Bookkeeper,
‘Bookkeeper’||’ (Senior)’ = 19 which is greater 1 character then varchar2(18) so it will raise the exception.

P0

P0

Looks like B, but it’s a dumb question for a test with time pressure. Student need to count letters to get the right answer.

dj

dj

A is the answer.

samkelo

samkelo

the answer is b

ali

ali

must be B
length is 18 and bookkeeper + ‘ (senior)’ = 19
just first job will be adding after that will be call exception

thanks for all

Fabio

Fabio

There’s nothing wrong in the code and in the forall. This question is a trap.

You think about the forall, look the code and it seems fine.

There’s a problem just with the max length of job column. If it is a varchar2(30), the code works.

So it’s B, just cause of job column length.

quart

quart

B is correct!!!
Everyone can easily check it.