Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Practical Database Programming With Visual C# .NET

Authors: Ying Bai

1st Edition

0470467274, 978-0470467275

More Books

Students also viewed these Databases questions

Question

Graph function in problem 10 2x if 0 x 20 400.5x ifx 20 h(x)

Answered: 1 week ago