RDBMS SOLUTION
ASSIGNMENT 2
SET A Q.1 SOLUTION
Write a PL/SQL block which accept a mobile number from user. If mobileno less than or more than 10 digits then raise an user defined exception “Invalid_Mobile No” otherwise display the “Correct input…! “.
Source code:
/* set b q 2 solution
in this question we have to check mobile number is not more and nor less then 10 digits,
for that we will use length() function*/
declare
n number:=:mobile_number;
invalid_mobile_number exception;
begin
if length(n)<>10 then
raise invalid_mobile_number;
else
dbms_output.put_line('correct input!!');
end if;
exception
when invalid_mobile_number then
dbms_output.put_line('Invalid number entered');
end;
0 Comments