Ad Code

Responsive Advertisement

Q. . Write a code/statements to declare variable grade Amt having datatype similar to tha of balance field of TAB1 table ?
Ans. Amt TAB1.balance% TYPE ;
Q. Write a code/statements to read two numbers and display their sum ?
Declare
Num1 Number(2);
Num2 Number(2);
Num3 Number(2);


Begin
Num1:=& Number1 ;
Num2 :=& Number2 ;
Num3:= Num1+Num2 ;
Dbms_output.put_line(‘The sum is ‘num3);
End;
Q. Write a code/statements to read two numbers and display their product ?
Declare
Num1 Number(2);
Num2 Number(2);
Num3 Number(2);
Begin
Num1:=& Number1 ;
Num2 :=& Number2 ;
Num3:= Num1*Num2 ;
Dbms_output.put_line(‘The product is ‘num3);
End;
Q. Write a code/statements to read two numbers and display their product ?
Declare
Num1 Number(2);
Num2 Number(2);
Num3 Number(2);
Sq1 Number(2);
Begin
Num1:=& Number1 ;
Num2 :=& Number2 ;
Sq1:= Num1*Num1 ;
Dbms_output.Enable ;
If num1>num2
Then
Dbms_output.Put_line(‘Square of bigger no. is’sq1);
Else
Dbms_output.Put_line(‘First no. is less than second no.’);
End If;
End;

Post a Comment

0 Comments

Close Menu