Examine the following DECLARE section of PL/SQL block:
Which line in the above declaration would generate an error?
A. Line 2
B. Line 3
C. Line 4
D. Line 5
E. Line 6
Examine the following DECLARE section of PL/SQL block:
Which line in the above declaration would generate an error?
A. Line 2
B. Line 3
C. Line 4
D. Line 5
E. Line 6
Correct Answer: A
Like said below: varchar2 should have a size parameter which is missing in the above statement.
DECLARE
v_job_type varchar2:=’TEMP’;
v_startdate date:=sysdate;
v_enddate date:=v_startdate+10;
c_tax_rate constant number(2):=8.25;
v_valid boolean not null default true;
begin
null;
end;
/
ERROR at line 2:
ORA-06550: line 2, column 12:
PLS-00215: String length constraints must be in range (1 .. 32767)
You are right, because the varchar2 should have a size parameter which is missing in the above statement.
declare
v_test constant number(2) := 8.25;
begin
dbms_output.put_line(v_test);
end;
OUTPUT:
8
I think letter ‘A’ is the incorrect, because this block generates error:
declare
v_test varchar2 := ‘TEMP’;
begin
null;
end;
it should be line number 5 since the number(2) does not allow decimal point
Decimal part will be round off. no error produce by oracle