aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/tests/sql/suites/action/runtime_if_select.sql
blob: c81f207ae99eaab9cb4f95888dfa48026ee1f440 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/* syntax version 1 */
/* postgres can not */
use plato;

insert into @foo
select count(*) as count from Input;
commit;
$n = (select count from @foo);
$predicate = $n > 1;

if $predicate do begin
    select 1;
end do;

if not $predicate do begin
    select 2;
end do;

if $predicate do begin
    select 3;
end do else do begin
    select 4;
end do;

if not $predicate do begin
    select 5;
end do else do begin
    select 6;
end do;