Question
This is what I am looking at (from MySQL Workbench): https://imgur.com/a/JDp90 CREATE OR REPLACE PROCEDURE CH08_PRC_CUST_ADD (W_CN IN NUMBER, W_CLN IN VARCHAR, W_CFN IN VARCHAR,
This is what I am looking at (from MySQL Workbench): https://imgur.com/a/JDp90
CREATE OR REPLACE PROCEDURE CH08_PRC_CUST_ADD (W_CN IN NUMBER, W_CLN IN VARCHAR, W_CFN IN VARCHAR, W_CBAL IN NUMBER) AS BEGIN INSERT INTO CH08_CUSTOMER (CUST_NUM, CUST_LNAME, CUST_FNAME, CUST_BALANCE) VALUES (W_CN, W_CLN, W_CFN, W_CBAL) END;
EXEC PRC_CUST_ADD (1002,'Rauthor','Peter',0.00); SELECT * FROM CUSTOMER;
CREATE TRIGGER CH08_TRG_UPDATECUSTBALANCE2 AFTER DELETE ON INVOICE FOR EACH ROW BEGIN UPDATE CH08_CUSTOMER SET CUST_BALANCE = CUST_BALANCE - OLD.INV_AMOUNT WHERE CUST_NUM = OLD.CUST_NUM END;
I am trying to create a procedure and a trigger, but am getting syntax errors.
Line 2 says "PROCEDURE" is not valid input
Line 10 says "EXEC" is not valid input
Line 20 says there is a missing semicolon.
What are the syntax errors? Please show the correct code.
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