aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/tests/sql/suites/params/param_in_json_api.sql
blob: 714240ad4c477b06490e0e18dc234e153b77574c (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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/* syntax version 1 */
/* postgres can not */

DECLARE $input_json as Json;
DECLARE $int64_param as Int64;
DECLARE $double_param as Double;
DECLARE $bool_param as Bool;
DECLARE $string_param as Utf8;
DECLARE $json_param as Json;

SELECT
    JSON_VALUE(
        $input_json,
        "strict $var"
        PASSING
            $int64_param as var
        RETURNING Int64
    ),
    JSON_VALUE(
        $input_json,
        "strict $var"
        PASSING
            $double_param as var
        RETURNING Double
    ),
    JSON_VALUE(
        $input_json,
        "strict $var"
        PASSING
            $bool_param as var
        RETURNING Bool
    ),
    JSON_VALUE(
        $input_json,
        "strict $var"
        PASSING
            $string_param as var
        RETURNING String
    ),
    JSON_QUERY(
        $input_json,
        "strict $var"
        PASSING
            $json_param as var
    );