Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/json/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
传递一个对象(.net或json对象)作为postgresql函数的输入参数_Sql_Json_Postgresql - Fatal编程技术网

传递一个对象(.net或json对象)作为postgresql函数的输入参数

传递一个对象(.net或json对象)作为postgresql函数的输入参数,sql,json,postgresql,Sql,Json,Postgresql,我刚刚开始学习postgresql,我想发送一个c#对象作为postgresql函数(storedprocedure)的参数 i、 e.假设我有一个名为userdetails的类,其中包含用户名、密码、DOB等字段 在插入到所需表的相应列之前,如何直接将此对象发送到函数并从对象中检索每个字段?这是函数以json为参数的示例: create or replace function works_with_json(_j IN json) returns boolean as $$ declare b

我刚刚开始学习postgresql,我想发送一个c#对象作为postgresql函数(storedprocedure)的参数

i、 e.假设我有一个名为userdetails的类,其中包含用户名、密码、DOB等字段


在插入到所需表的相应列之前,如何直接将此对象发送到函数并从对象中检索每个字段?

这是函数以json为参数的示例:

create or replace function works_with_json(_j IN json) returns boolean as
$$
declare
begin
    raise info '%', 'a = "'||(_j->>'a')||'"';
    raise info '%', 'b = "'||(_j->>'b')||'"';
    return _j->>'c';
end;
$$ language plpgsql;

select works_with_json ('{"a":"Some string","b":9, "c": true}');

如果您想将json作为参数传递给函数,只需这样做即可。@vao tsun如何实现这一点并将数据插入表的各个列中?举个例子给我一个正确的方向。