write a script that creates and calls a stored procedure named test. this procedure should attempt to update the invoice_due_date column so it's equal th null for the invoice with an invoice id of 1
-- return message if category not insert successfully
-- message in array with msg key
DELIMITER $$
CREATE PROCEDURE mycheck6 (IN name varchar(50))
BEGIN
-- return message if category not insert successfully
DECLARE CONTINUE HANDLER FOR 1062
SELECT CONCAT('Row was not inserted - duplicate entry.') AS msg;
-- insert a new category name
insert into categories2 (name) values (name);
-- return message if insert successfully
SELECT CONCAT('1 row was inserted.') AS msg;
END$$
DELIMITER ;
--Some other example here
-- in this example you set error message according to SIGNAL SQLSTATE '45000'
DELIMITER $$
CREATE PROCEDURE mycheck (IN name varchar(50))
BEGIN
insert into categories2 (name) values (name);
IF ROW_COUNT() > 0
then
SIGNAL SQLSTATE '45000'
SET MESSAGE_TEXT = "1 row was inserted.";
else
SIGNAL SQLSTATE '45000'
SET MESSAGE_TEXT = "Row was not inserted - duplicate entry.";
end if;
END$$
DELIMITER ;
write a script that creates and calls a stored procedure named test. this procedure should attempt...
Write a script that creates and calls a stored procedure named spInsertProduct that inserts a row into the Products table. This stored procedure should accept five parameters. One parameter for each of these columns: CategoryID, ProductCode, ProductName, ListPrice, and DiscountPercent. This stored procedure should set the Description column to an empty string, and it should set the DateAdded column to the current date. If the value for the ListPrice column is a negative number, the stored procedure should raise an...
Write a script in MySQL that creates and calls a stored procedure name test. This procedure should calculate the factorial for the number 10. (To calculate a factorial, you multiply an integer less than itself.) Then, it should display a string that includes the factorial like this: The factorial of 10 is: 3,628,800.
1. Write a script that creates a user-defined database role named OrderEntry in the MyGuitarShop database. Give INSERT and UPDATE permission to the new role for the Orders and OrderItems table. Give SELECT permission for all user tables. 2. Write a script that (1) creates a login ID named “RobertHalliday” with the password “HelloBob”; (2) sets the default database for the login to the MyGuitarShop database; (3) creates a user named “RobertHalliday” for the login; and (4) assigns the user...
Programming Exercise 4.9
Write a script named numberlines.py. This script
creates a program listing from a source program.
This script should:
Prompt the user for the names of two files.
The input filename could be the name of the script itself, but
be careful to use a different output filename!
The script copies the lines of text from the input file to the
output file, numbering each line as it goes.
The line numbers should be right-justified in 4 columns,...
1. Write a script that creates a user-defined database role named OrderEntry in the MyGuitarShop database. Give INSERT and UPDATE permission to the new role for the Orders and OrderItems table. Give SELECT permission for all user tables. 3) Write a script that uses dynamic SQL and a cursor to loop through each row of the Administrators table and (1) create a login ID for each row in that consists of the administrator�s first and last name with no space...
Write an UPDATE statement that modifies the invoice you added in exercise 4. This statement should change the credit_total column so it's 10% of the invoice_total column, and it should change the payment_total column so the sum of the payment_total and credit_total columns are equal to the invoice_total column.
please write a procedure in Python that meets the following critera. Named FlipSign The procedure should accept a single numeric argument The procedure should return that number with the opposite sign (multiply by -1)
For Python
| Instructions Write a script named difpy. This script should prompt the user for the names of two text files and compare the contents of the two files to see if they are the same. 1. If they are the script should simply output "Yes". 2. If they are not the script should output "No", followed by the first lines of each file that differ from each other The input loop should read and compare lines from each...
2. Write a script that implements the following design: In the Downloads table, the user_id and product_id columns are the foreign keys. Create these tables in the ex schema. Create the sequences for the user_id, download_id, and product_id columns. Include a PL/SQL script to drop the table or sequence if it already exists. Include any indexes that you think are necessary. 3. Write a script that adds rows to the database that you created in exercise 2. Add two rows...
3. Write a script that adds rows to the database that you created in exercise 2. Add two rows to the Users and Products tables. Add three rows to the Downloads table: one row for user 1 and product 2; one row for user 2 and product 1; and one row for user 2 and product 2. Use the SYSDATE function to insert the current date into the download_date column. Use the sequences created in the previous exercise to get...