Skip to content

Commit 0999fef

Browse files
committed
Add scripts for create procedure tests for other databases
1 parent dc5a2e1 commit 0999fef

3 files changed

Lines changed: 32 additions & 2 deletions

File tree

test/resources/create_stored_procedure_mssql.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,5 @@ END
4646
ELSE
4747
BEGIN
4848
PRINT 'Condition is false';
49-
END;
49+
END
5050
END;

test/resources/create_stored_procedure_mysql.sql

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,15 @@ CREATE PROCEDURE get_all_first_and_second_names()
2727
BEGIN
2828
SELECT FIRST_NAME FROM person;
2929
SELECT LAST_NAME FROM person;
30-
END;
30+
END;
31+
32+
DROP PROCEDURE IF EXISTS check_condition;
33+
CREATE PROCEDURE check_condition()
34+
BEGIN
35+
DECLARE v_condition BOOLEAN DEFAULT TRUE;
36+
IF v_condition THEN
37+
SELECT 'Condition is true' AS Result;
38+
ELSE
39+
SELECT 'Condition is false' AS Result;
40+
END IF;
41+
END

test/resources/create_stored_procedure_postgres.sql

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,23 @@ RETURN NEXT result1;
4949
OPEN result2 FOR SELECT LAST_NAME FROM person;
5050
RETURN NEXT result2;
5151
END
52+
';
53+
54+
DROP ROUTINE IF EXISTS check_condition;
55+
CREATE FUNCTION
56+
check_condition()
57+
RETURNS VOID
58+
LANGUAGE plpgsql
59+
AS
60+
'
61+
DECLARE
62+
v_condition BOOLEAN := TRUE;
63+
v_res BOOLEAN := TRUE;
64+
BEGIN
65+
IF v_condition THEN
66+
v_res := TRUE;
67+
ELSE
68+
v_res := FALSE;
69+
END IF;
70+
END
5271
';

0 commit comments

Comments
 (0)