HOW TO FIX THIS CODE IN ORACLE SQL ? CREATE OR REPLACE PROCEDURE CONVERT_VAL(V1 VARCHAR,V2 VARCHAR,AMT NUMBER) IS val VARCHAR2(100); val1 VARCHAR2(2); val2 varchar2(2); amount number; DECLARE meter...


 HOW TO FIX THIS CODE IN ORACLE SQL ?
CREATE OR REPLACE PROCEDURE CONVERT_VAL(V1 VARCHAR,V2 VARCHAR,AMT NUMBER) IS
 val VARCHAR2(100);
 val1 VARCHAR2(2);
 val2 varchar2(2);
 amount number;


   DECLARE
      meter NUMBER := 0;
       Cem NUMBER := 0;
   BEGIN
    val1:=v1;
    val2:=v2;
    amount:=amt;
    Select case when val1!=val2 then
                          case
                          when lower(val1)='km'
      meter := km * 1000;
      Cem := meter * 100;
      dbms_output.Put_line('The value of KM NUMBER KM to meters is: ' ||meter);
      dbms_output.Put_line('The value of KM NUMBER KM to centimeters is: ' ||cem);
  when lower(val1)='m'
     dbms_output.Put_line('The value of M NUMBER M to KM is: ' ||KM);
      dbms_output.Put_line('The value of M NUMBER M to centimeters is: ' ||cem);
        when lower(val1)='Cm'
     dbms_output.Put_line('The value of M NUMBER CM to KM is: ' ||KM);
      dbms_output.Put_line('The value of M NUMBER CM to M is: ' ||M);
      else
                          'same metric conversion is not possible OR YOUR INPUT IS INCORRECT '
                                                                           end
                                                  as val into val
                                                  from dual;

                                                        dbms_output.Put_line(val);

END;


/


BEGIN
CONVERT_VAL;
END;


------I ENTER METER ,KM OR CM ,IT WILL convert to the corresponding other unit。


the code is not working .



Jun 07, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here