is the sql code .and it have error . CREATE or replace PROCEDURE CONVERT_VAL(&v1 varchar2(2), &v2 varchar2(2), &amt number) as val varchar(100); val1 varchar(2):= ':v1'; val2 varchar(2):=':v2';

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
icon
Concept explainers
Question
100%

this oracle code have some error , how to fix it ?

this is the sql code .and it have error .

CREATE or replace PROCEDURE CONVERT_VAL(&v1  varchar2(2), &v2 varchar2(2), &amt  number)
as
val varchar(100);
val1 varchar(2):= ':v1';
val2 varchar(2):=':v2';
amount number:= :amt;
Begin
Select case when val1!=val2 then 
                         case
                         when lower(val1)='km' and lower(val2) = 'cm' 
                                             then amount||lower(val1) ||amount*100000||' '||lower(val2)
                                         when lower(val1)='km' and lower(val2) = 'mt'            
                                                 then amount||lower(val1) ||amount*1000||' '||lower(val2)
                                                 when lower(val1)='km' and lower(val2) = 'mm'
                                                 then amount||lower(val1) ||amount*1000000||' '||lower(val2)
                         when lower(val1)='cm' and lower(val2) = 'km' 
                                             then amount||lower(val1) ||amount/100000||' '||lower(val2)
                                         when lower(val1)='cm' and lower(val2) = 'mt'
                                                 then amount||lower(val1) ||amount*0.01||' '||lower(val2)
                                     when lower(val1)='cm' and lower(val2) = 'mm'
                                                 then amount||lower(val1) ||amount*10||' '||lower(val2)
                                         when lower(val1)='mt' and lower(val2) = 'km'            
                                                 then amount||lower(val1) ||amount/1000||' '||lower(val2)
                                         when lower(val1)='mt' and lower(val2) = 'cm'            
                                                 then amount||lower(val1) ||amount*100||' '||lower(val2)                                                 
                                         when lower(val1)='mt' and lower(val2) = 'mm'            
                                                 then amount||lower(val1) ||amount*1000||' '||lower(val2)                                                
                                         when lower(val1)='mm' and lower(val2) = 'km'
                                                 then amount||lower(val1) ||amount/1000000||' '||lower(val2)
                                         when lower(val1)='mm' and lower(val2) = 'mt'
                                                 then amount||lower(val1) ||amount*0.001||' '||lower(val2)
                                         when lower(val1)='mm' and lower(val2) = 'cm'
                                                 then amount||lower(val1) ||amount*0.1||' '||lower(val2)
                                                 end
                  else 
                         'same metric conversion is not possible'                      
                                                 
                                                 end 
                                                 as val into val 
                                                 from dual;
                                                                                                 
                                                       dbms_output.Put_line(val);
                                         
END;
/

---

Procedure CONVERT_VAL compiled

LINE/COL  ERROR
--------- -------------------------------------------------------------
1/35      PLS-00103: Encountered the symbol "(" when expecting one of the following:     := . ) , @ % default character The symbol ":=" was substituted for "(" to continue. 
1/50      PLS-00103: Encountered the symbol "(" when expecting one of the following:     := . ) , @ % default character The symbol ":=" was substituted for "(" to continue. 
1/55      PLS-00103: Encountered the symbol "1" when expecting one of the following:     <an identifier> <a double-quoted delimited-identifier>    current delete exists prior The symbol "<an identifier> was inserted before "1" to continue. 
6/17      PLS-00049: bad bind variable 'AMT'
Errors: check compiler log

this is a unit conversion

1st: fromwhat unit

2nd : to what unit 

3rd :is the amount .

like enter km ,cm ,1,will output 1km =1000000cm

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 4 images

Blurred answer
Knowledge Booster
Query Syntax
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education