Concept explainers
I need to create a PL/SQL
The program should continue to find odd and even numbers from 1 to the maximum number given (entered) by the user.
If user input is less than or equal to zero Program should not even start doing its task and right away print ‘Sorry I can not calculate odd and even numbers for negative or zero’.
But when user entered any positive number then the program should display all numbers as either even or odd.
Here is the example;
Assume user entered 12. This will be cap number
From 1 to 12 all the numbers in between your program will be finding out each of the number either as odd or even
1 is odd number
2 is even number
3 is odd number
4 is even number
5 is odd number
6 is even number
7 is odd number
8 is even number
9 is odd number
10 is even number
11 is odd number
12 is even number
Thank you in advance!
Step by stepSolved in 4 steps with 5 images
Sorry, is there any way to print it out like my example?
ex)
1 is odd number
2 is even number
3 is odd number
4 is even number
5 is odd number
6 is even number
7 is odd number
8 is even number
9 is odd number
10 is even number
11 is odd number
12 is even number
That code gives me an error that "Bind variable "ENTER_MAX_NUMBER" not declared".
Sorry, is there any way to print it out like my example?
ex)
1 is odd number
2 is even number
3 is odd number
4 is even number
5 is odd number
6 is even number
7 is odd number
8 is even number
9 is odd number
10 is even number
11 is odd number
12 is even number
That code gives me an error that "Bind variable "ENTER_MAX_NUMBER" not declared".
- Create a PL/SQL database programming block with DECLARE BEGIN END; In Declare section define a local scalar (simple) variables. lv_deptno NUMBER And assign initial values as 10 lv_deptno NUMBER := 50; In Declare section again, define a cursor and select last_name, salary and manager_id of employees the ones who are working in the department defined in a) In this example department will be lv_deptno:=50; Sample code: Cursor c_emp as SELECT last_name, salary, manager_id FROM employees WHERE department_id = lv_deptno; In the execution section (BEGIN and END) Create CURSOR FOR LOOP for cursor to process In this cursor loop, your code has to check salary and also manager_id numbers each time new records being fetched. And based on these conditions either employee gets raise or not get raise. If employee salary is less than 5000 and also if employees managers is either 101 or 124 then it means employee is due for raise otherwise employee is not due for raise Sample…arrow_forwardIn EXCEPT (MINUS) queries, the order of operands matters, but in UNION queries, it doesn't?arrow_forwardYou are writing code that is equivalent to: X = A / (5 + B) Assume signed bytes and the following first 3 lines of code: mov al,A mov bl,B add bl,5 What is the last one line of code?arrow_forward
- write sql function to calculate GPA as seen on my image sentarrow_forward423532.1801938.qx3zqy7 Jump to level 1 Complete the SQL statement to generate the Result table. Order Part Number Quantity 492 492 662 Check OrderCode Z23 R58 A36 1 Next 3 4 1 Order.PartNumber 662 SELECT */Type your code here */ FROM Order, Part WHERE */Type your code here */ Result 2 ●PartNumber 827 662 PartName Part Wingding PartName Price Left wizard 1000 Wingding 11 ; 3arrow_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_forward
- Can you write an SQL program that includes tables that classify different levels of college students based on their GPA?arrow_forwardWrite a stored procedure called sp_apply_discount() that will apply percent discount to books in a subject. The stored procedure takes in 2 parameters, percentDiscount (DECIMAL(8,2)) and subject (VARCHAR(120)). Using these parameters, the stored procedure computes the discount for the book cost and stores it in the FINAL_PRICE field. For example, the following stored procedure call: call sp_apply_discount(0.15, 'Database');would compute 15% percent discount from the book cost in the Database subject category and store it in the FINAL_PRICE column as depicted in this image:arrow_forwardDatabase: https://www.w3schools.com/sql/trysql.asp?filename=trysql_select_allarrow_forward
- Which operator should you use to find NULL values?arrow_forwardUse My Guitar Shop Database Use Microsoft SQL Server Write a script that includes these statements coded as a transaction: INSERT Orders VALUES (3, GETDATE(), '10.00', '0.00', NULL, 4, 'American Express', '378282246310005', '04/2019', 4); SET @OrderID = @@IDENTITY; INSERT OrderItems VALUES (@OrderID, 6, '415.00', '161.85', 1); INSERT OrderItems VALUES (@OrderID, 1, '699.00', '209.70', 1); Here, the @@IDENTITY variable is used to get the order ID value that’s automatically generated when the first INSERT statement inserts an order. If these statements execute successfully, commit the changes. Otherwise, roll back the changes.arrow_forwardWhen you don’t know the specific value to include in the criteria, you use a ____. a. limited query b. unfilled query c. tagged query d. parameter queryarrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education