日韩久久久精品,亚洲精品久久久久久久久久久,亚洲欧美一区二区三区国产精品 ,一区二区福利

oracle pl/sql 中的動(dòng)態(tài)函數(shù)

系統(tǒng) 2869 0

1.execute immediate

create or replace function getrealtypeforreport(p_stanid number,p_id number,p_infoname varchar2) return varchar2
is
?v_string???????????????? varchar2(200);
?v_returninfo???????????? varchar2(200);
?v_acttabname???????????? stanactive.acttabname%type;
?v_actpkcol?????????????? stanactive.actpkcol%type;
begin
???? select acttabname,actpkcol into v_acttabname,v_actpkcol from stanactive where stanid=p_stanid;
???v_string:='select realtype from vw_'||v_acttabname||' where '||v_actpkcol||' = '||p_id;
???execute immediate v_string into v_returninfo;
?return v_returninfo;
end;
/
show err;

2.?Open ttdscur for v_sql

create or replace function getfieldstring(p_expectfield varchar2,p_expecttable varchar2,p_expectcause varchar2) return varchar2
is
/*
函數(shù)功能:獲取單個(gè)屬性將其拼成一行
參數(shù)說明:p_expectfield?? 查詢字段
????????? p_expecttable?? 查詢主表
????????? p_expectcause?? 查詢條件
*/
?v_sql??? varchar2(4000):='';
?type ttds_cursor is ref cursor;
?ttdscur?????ttds_cursor;
?ttdigital????varchar2(4000);
?v_cnt?????????????????? number;
?v_return? varchar2(4000):='';
begin
?v_sql:='select '||p_expectfield||' from '||p_expecttable||' where '||p_expectcause;
?v_cnt:=0;
?Open ttdscur for v_sql;
?loop
??fetch ttdscur into ttdigital;
??exit when ttdscur%notfound;
??if v_cnt=0 then
???v_return:=ttdigital;
??else
???v_return:=v_return||','||ttdigital;
??end if;
??v_cnt:=v_cnt+1;
?end loop;
?Close ttdscur;
?return v_return;
end getfieldstring;
/
show err;

舉例:

select getfieldstring('certno','rightcert','activeid=@id and certtypeid in (3)') from dual;

?

?

oracle pl/sql 中的動(dòng)態(tài)函數(shù)


更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號(hào)聯(lián)系: 360901061

您的支持是博主寫作最大的動(dòng)力,如果您喜歡我的文章,感覺我的文章對(duì)您有幫助,請(qǐng)用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點(diǎn)擊下面給點(diǎn)支持吧,站長非常感激您!手機(jī)微信長按不能支付解決辦法:請(qǐng)將微信支付二維碼保存到相冊(cè),切換到微信,然后點(diǎn)擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對(duì)您有幫助就好】

您的支持是博主寫作最大的動(dòng)力,如果您喜歡我的文章,感覺我的文章對(duì)您有幫助,請(qǐng)用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會(huì)非常 感謝您的哦!!!

發(fā)表我的評(píng)論
最新評(píng)論 總共0條評(píng)論
主站蜘蛛池模板: 沧州市| 濉溪县| 杭州市| 井冈山市| 许昌县| 深泽县| 荔浦县| 六枝特区| 大渡口区| 林州市| 寿光市| 邢台市| 固安县| 阜宁县| 芒康县| 休宁县| 西林县| 梓潼县| 德江县| 大足县| 汽车| 英德市| 镇江市| 兰坪| 微山县| 广饶县| 来凤县| 海城市| 旌德县| 阿合奇县| 临夏市| 健康| 宣恩县| 通化县| 新密市| 桦川县| 海兴县| 晋城| 衡山县| 津市市| 闽侯县|