Answer the question
In order to leave comments, you need to log in
How to add input validation to a stored procedure?
Good day. I have such a problem. There is a task: To develop stored procedures for adding/changing/deleting data. It is necessary to add checks of input data to the procedures according to the table above. (data type, NOT NULL condition, data uniqueness) If incorrect data is entered, output text with a readable error.
There is a code with a procedure:
CREATE PROCEDURE add_product (a INT, b TIMESTAMP, c VARCHAR(20), d VARCHAR(50), e INT, f INT)
LANGUAGE SQL
AS $$
INSERT INTO sales (ID, Sale_time, Pharmacy, product, Number_of_packages, Price)
VALUES (a, b, c, d, e, f);
$$;
How to add input validation to this procedure? Thank you in advance
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question