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 .
Step by stepSolved in 2 steps
- Function is in pl/sqlarrow_forwardT-SQL procedure for MICROSOFT SQL SERVER A: obtain the name and credit limit of the customer whose number currently is stored in I_CUSTOMER_NUM. Place these values in the variables I_CUSTOMER_NAME and I_CREDIT_LIMIT, respectively. Output the content of I_CUSTOMER_NAME and I_CREDIT_LIMIT. HINT use cursor instructions as a template for the problem. Instructions goes as follows CREATE PROCEDURE usp_DISP_REP_CUST @repnum char(2) AS DECLARE@custnum char(3) DECLARE@custname char(35) DECLARE mycursor CURSOR READ_ONLY FOR SELECT CUSTOMER_NUM, CUSTOMER_NAME FROM CUSTOMER WHERE REP_NUM = @repnum OPEN mycursor FETCH NEXT FROM mycursor INTO @custnum, @custname WHILE @@FETCH_STATUS=0 BEGIN PRINT@custnum+' '+@custname FETCH NEXT FROM mycursor INTO @custnum, @custname END CLOSE mycursor DEALLOCATE mycursorarrow_forwardWrite SQL code for the following: Create a stored procedure “setRelocationFee” to set the relocation fee for a givenemployee. If the employee’s office is in San Francisco, the relocation fee is $10000; ifthe employee’s office is in Boston, the relocation fee is $8000; if the employee’s officeis in London, the relocation fee is $20000; if the employee works in other offices, therelocation fee is $15000. (see image for table structure) I am stuck for the part that I have to select employeeNumber and officeCode and set the relocationFee to be able to obtain the result but I do not know how. Bellow is what I have gotten. Delimiter| CREATE PROCEDURE setRealocationFee(IN EmployeeID INT(11), OUT realocationFee INT(5))arrow_forward
- Write a PL/SQL stored procedure to print number of employees who are working in a job with Title "Tester". Include procedure call also. If the total count of Employees is more than 5 then print "Sufficient number of Employees" If the total count of Employees is less than 5 then print "Insufficient number of Employees" Else print "there are 5 employees". Use Oracle's NO DATA_FOUND build in exception to display the last message. DEPARTMENTS LOCATIONS P DEPARTMENT_ID * DEPARTMENT_NAME MANAGER_ID LOCATION_ID P LOCATION_ID STREET ADDRESS POSTAL_CODE * CITY STATE PROVINCE COUNTRY_ID JOB_HISTORY PF* EMPLOYEE_ID P * START DATE * END DATE F JOB ID F DEPARTMENT_ID EMPLOYEES P EMPLOYEE_ID FIRST NAME * LAST_NAME EMAIL COUNTRIES COUNTRY_ID COUNTRY_NAME F REGION ID PHONE_NUMBER * HIRE DATE F JOB_ID JOBS P JOB_ID * JOB_TITLE MIN_SALARY MAX_SALARY SALARY COMMISSION_PCT MANAGER_ID F REGIONS DEPARTMENT_ID P* REGION_ID REGION_NAME I--arrow_forwardDatabase https://www.w3schools.com/sql/trysql.asp?filename=trysql_select_allarrow_forwardINFO 2303 Database Programming Assignment : PL/SQL Practice Note: PL/SQL can be executed in SQL*Plus or SQL Developer or Oracle Live SQL. Write an anonymous PL/SQL block that will delete all patients for doctors that works in the Family Practice Verify that patients have been deleted accordingly. Then do a select * from patients where doc_id = (select doc_id from doctor where area = ‘Family Practice’. You should get no rows.arrow_forward
- In PL/SQL, which of the following variable type is used to declare a record? %ROWTYPE %TYPE %RECORDTYPE %TYPEROWarrow_forwardSQL ( ORACLE SQL DEVELOPER ) : THIS IS FIRST , SECOND AND THIRD TABLE for the Task 1 to solve : create table author_45( auth_name char(50), gender char(1), age number(3), nationality char(50), PRIMARY KEY (auth_name) ); create table book_45( isbn number(10), title char(50), ver_no number(2), publisher char(50), PRIMARY KEY (isbn) ); create table writtenBy_45( isbn number(10), auth_name char(50), yr_published number(4), price number(3), no_copy number(4), PRIMARY KEY (isbn,auth_name), foreign key (isbn) references book_45, foreign key (auth_name) references author_45 ); insert into author_45 values ('Benoit','F',42,'French'); insert into author_ 45 values ('Antonini','M',33,'Italian'); insert into author_ 45 values ('McAven','F',31,'Australian'); insert into author_ 45 values ('Williams','M',90,'British'); insert into book_45 values (101,'atabases',1,'Possum'); insert into book_45 values (202,'SQL Primer',2,'Hall'); insert into book_45 values…arrow_forwardin sql The ALTER SEQUENCE statement can be used to: Select one: a. Change the maximum value to a lower number than was last used b. Change the name of the sequence c. Change the START WITH value of a sequence d. Change the amount a sequence increments each time a number is generatedarrow_forward
- Computer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Concepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningPrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY