如何在out参数中获取select语句的值? [英] How to get the value of select statement in out parameter?

查看:192
本文介绍了如何在out参数中获取select语句的值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

创建或替换函数mhrorlat_udg.update_the_db(IN para_table_catalog文本,IN para_table_schema文本,IN para_table_name文本,OUT para_id文本)

退回文本AS

$ BODY $

声明

str text;

BEGIN



str:='select true FROM information_schema.tables WHERE table_catalog ='''|| $ 1 ||'''和table_schema ='''|| $ 2 ||'''和table_name ='''|| $ 3 ||'''';

EXECUTE(str);





END;

$ BODY $

LANGUAGE'plpgsql'VOLATILE

成本100;

更新功能mhrorlat_udg.update_the_db(文字,文字,文字)所有者的帖子;



选择mhrorlat_udg.update_the_db('mhrorlat','mhrorlat_udg','mut_kharedi_old');

drop function mhrorlat_udg.update_the_db(text,text,text);

CREATE OR REPLACE FUNCTION mhrorlat_udg.update_the_db(IN para_table_catalog text, IN para_table_schema text,IN para_table_name text, OUT para_id text)
RETURNS text AS
$BODY$
declare
str text;
BEGIN

str:= 'select true FROM information_schema.tables WHERE table_catalog='''|| $1 ||''' and table_schema=''' || $2 ||'''and table_name='''||$3||'''';
EXECUTE (str);


END;
$BODY$
LANGUAGE 'plpgsql' VOLATILE
COST 100;
ALTER FUNCTION mhrorlat_udg.update_the_db(text, text,text) OWNER TO postgres;

select mhrorlat_udg.update_the_db('mhrorlat','mhrorlat_udg','mut_kharedi_old');
drop function mhrorlat_udg.update_the_db(text, text,text);

推荐答案

BODY




声明

str text;

BEGIN



str:='select true FROM information_schema.tables WHERE table_catalog ='''||

declare
str text;
BEGIN

str:= 'select true FROM information_schema.tables WHERE table_catalog='''||


1 ||'''和table_schema ='''||
1 ||''' and table_schema=''' ||


这篇关于如何在out参数中获取select语句的值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆