1 write a script that uses an anonymous block of pl sql code to declare a variable a 5347022

1.      Write a script that uses an anonymous block of PL/SQL code to declare a variable and set it to the count of all products in the Products table. If the count is greater than or equal to 7, the block should display a message that says, “The number of products is greater than or equal to 7”. Otherwise, it should say, “The number of products is less than 7”.

2.      Write a script that uses an anonymous block of PL/SQL code to declare two variables to store (1) the count of all of the products in the Products table and (2) the average list price for those products. If the product count is greater than or equal to 7, the stored procedure should display a result set that displays the values of both variables. Otherwise, the procedure should display a result set that displays a message that says, “The number of products is less than 7”.

3.Write a script that uses an anonymous block of PL/SQL code that calculates the common factors between 10 and 20. To find a common factor, you can use the modulo function (MOD) to check whether a number can be evenly divided into both numbers. Then, this procedure should display a string that displays the common factors like this:

Common factors of 10 and 20: 1 2 5

4.      Write a script that uses an anonymous block of PL/SQL code that creates a cursor for a result set that consists of the product_name and list_price columns for each product with a list price that’s greater than $700. The rows in this result set should be sorted in descending sequence by list price. Then, the procedure should display a string variable that includes the product_name and list price for each product so it looks something like this:

“Gibson SG”,”2517.00″|”Gibson Les Paul”,”1199.00″|

Here, each value is enclosed in double quotes (“), each column is separated by a comma (,) and each row is separated by a pipe character (|).

5.Write a script that uses an anonymous block of PL/SQL code that attempts to insert a new category named “Guitars” into the Categories table. If the insert is successful, the procedure should display this message:

1 row was inserted.

If the update is unsuccessful, the procedure should display this message:

Row was not inserted – duplicate entry.

"Get 15% discount on your first 3 orders with us"
Use the following coupon
FIRST15

Order Now