Skip to content

Commit 718891f

Browse files
committed
Tests for PL/SQL block with IF condition inside - Oracle and MSSQL
1 parent 421dffe commit 718891f

3 files changed

Lines changed: 29 additions & 1 deletion

File tree

test/resources/create_stored_procedure_mssql.sql

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,18 @@ BEGIN
3333
SELECT FIRST_NAME FROM person;
3434
SELECT LAST_NAME FROM person;
3535
RETURN;
36+
END;
37+
38+
DROP PROCEDURE IF EXISTS check_condition;
39+
CREATE PROCEDURE check_condition
40+
AS
41+
DECLARE @v_condition BIT = 1;
42+
IF @v_condition = 1
43+
BEGIN
44+
PRINT 'Condition is true';
45+
END
46+
ELSE
47+
BEGIN
48+
PRINT 'Condition is false';
49+
END;
3650
END;

test/resources/create_stored_procedures_oracle.sql

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,15 @@ OPEN first_names_cursor for
2929
SELECT FIRST_NAME FROM person;
3030
OPEN second_names_cursor for
3131
SELECT LAST_NAME FROM person;
32-
END;
32+
END;
33+
34+
CREATE OR REPLACE PROCEDURE
35+
check_condition AS
36+
v_condition BOOLEAN := TRUE;
37+
BEGIN
38+
IF v_condition THEN
39+
DBMS_OUTPUT.PUT_LINE('Condition is true');
40+
ELSE
41+
DBMS_OUTPUT.PUT_LINE('Condition is false');
42+
END IF;
43+
END check_condition;

test/tests/common_tests/stored_procedures.robot

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@ Procedure Returns Multiple Result Sets
8888
Should Be Equal ${second result set}[0][0] See
8989
Should Be Equal ${second result set}[1][0] Schneider
9090

91+
Procedure With IF/ELSE Block
92+
Call Stored Procedure check_condition
93+
9194

9295
*** Keywords ***
9396
Create And Fill Tables And Stored Procedures

0 commit comments

Comments
 (0)