DELETE
DELETE in SQL Script removes records from a table.
Syntax
DELETE FROM <table> [WHERE <conditionalExpression>]
Remarks
• Any legal DELETE statement that the system accepts can be used as a standalone SQL Script statement.
• Variables are allowed in a SQL statement anywhere literals are allowed.
Examples
PROCEDURE p ( )
BEGIN
DELETE FROM /shared/scores;
INSERT INTO /shared/scores VALUES ('Joe', 1001);
UPDATE /shared/.scores SET score=1239 WHERE name='Sue';
END
PROCEDURE p (IN p_name VARCHAR, IN new_score)
BEGIN
DELETE FROM /shared/scores WHERE name=p_name;
INSERT INTO /shared/scores VALUES (p_name, new_score);
UPDATE /shared/.scores SET score=new_score WHERE name=p_name;
END
PROCEDURE p (IN y VARCHAR)
BEGIN
--T has columns x and y
--The following y refers to the column, not the parameter
DELETE FROM /shared/T WHERE x = y;
END