Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I get this error running the following MYSQL script. ERROR 1064(42000) at line 1: You have an error in your SQL syntax; check them anual

I get this error running the following MYSQL script. ERROR 1064(42000) at line 1: You have an error in your SQL syntax; check them anual that corresponds to your MySQL server version for the rightsyntax to use near '' at line 3 CREATE PROCEDURE PRC_INV_AMOUNTS(IN W_IN INT) BEGIN DECLARE W_CHK INT DEFAULT 0; DECLARE W_SUBT INTDEFAULT 0; DECLARE W_TAX INT DEFAULT 0; SELECT COUNT(*) INTO W_CHKFROM INVOICE WHERE INV_NUMBER = W_IN; IF W_CHK = 1 THEN SELECTSUM(LINE_TOTAL) INTO W_SUBT FROM LINE WHERE LINE.INV_NUMBER = W_IN;SET W_TAX = W_SUBT * 0.08; UPDATE INVOICE SET INV_SUBTOTAL =W_SUBT, INV_TAX = W_TAX, INV_TOTAL = W_SUBT + W_TAX WHEREINV_NUMBER = W_IN; END IF; END; When I remove the declarestatements from the script , I get: ERROR 1327 (42000) at line 1:Undeclared variable: W_CHK. Is the syntax wrong for the declarestatements?

 

Step by Step Solution

There are 3 Steps involved in it

Step: 1

You should use DELIMITER keyword to create a procedure in MySQL Use the below script DELIMITER CR... 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

Step: 3

blur-text-image

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

Income Tax Fundamentals 2013

Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill

31st Edition

1111972516, 978-1285586618, 1285586611, 978-1285613109, 978-1111972516

More Books

Students also viewed these Electrical Engineering questions

Question

Tell me about yourself.

Answered: 1 week ago