1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

  2. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

POSTGRES ERROR: query string argument of EXECUTE is null

Discussão em 'Outras Linguagens' iniciado por Stack, Janeiro 18, 2021.

  1. Stack

    Stack Membro Participativo

    I am am to create this function, but when I call it I get an error of:


    query string argument of EXECUTE is null

    create or replace function test2 ( p_values text[])
    language 'plpgsql'
    as $body$

    declare

    l_sql text;
    l_sub_id m_subj.m_sub_id%type;

    Begin


    l_sql:= 'select a.column_value as cpODS,
    d.Ps5Dly as item_id,
    t1.request_id,
    t1.group_name
    from (select (coalesce(column_value, ''''::text)) as column_value from unnest($1) as column_value) a
    left outer join lab_dim_c d on :9 = d.item_id and d.subject_id = ' || l_sub_id || '
    inner join cdf_pass t1 on a.column_value = t1.cpODS';

    l_sql := replace(l_sql, ':9','a.column_value');

    EXECUTE l_sql USING p_values;/*These variables would replace the $1, $2, $3, $4*/

    end;
    $body$

    CALL test2(array['123435','12434']);


    I am clearly passing in values in my function call, and so I do not understand why there is an issue here. Can I have another pair of eyes on this?

    Continue reading...

Compartilhe esta Página