Question
I am getting this on my MySQL code. Error 1418: This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration
I am getting this on my MySQL code. Error 1418: This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable) SQL Statement: CREATE FUNCTION `discount_price` (itemIdParam INT) RETURNS DECIMAL(9,2) BEGIN DECLARE varDiscountPrice DECIMAL(9,2); SELECT item_price-discount_amount INTO varDiscountPrice FROM Order_Items WHERE itemId= itemIdParam; RETURN varDiscountPrice; END
CREATE FUNCTION discount_price ( item_id_param INT ) RETURNS DECIMAL(9,2) BEGIN DECLARE discount_price_var DECIMAL(9,2); SELECT item_price-discount_amount INTO discount_price_var FROM order_items WHERE item_id= item_id_param; RETURN discount_price_var; END
This is for this problem.
Write a script that creates and calls a stored function named discount_price that calculates the discount price of an item in the Order_Items table (discount amount subtracted from item price). To do that, this function should accept one parameter for the item ID, and it should return the value of the discount price for that item. Execute the query and take a screenshot of the query and the results.What am I doing wrong when creating the stored function?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started