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

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

系統(tǒng) 2619 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)支持吧,站長(zhǎng)非常感激您!手機(jī)微信長(zhǎng)按不能支付解決辦法:請(qǐng)將微信支付二維碼保存到相冊(cè),切換到微信,然后點(diǎn)擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

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

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

發(fā)表我的評(píng)論
最新評(píng)論 總共0條評(píng)論
主站蜘蛛池模板: 彰化县| 西充县| 扬中市| 大宁县| 五华县| 城市| 张家界市| 平遥县| 高清| 南充市| 焦作市| 高唐县| 定襄县| 子长县| 太和县| 唐山市| 嘉鱼县| 故城县| 蒲城县| 建平县| 罗田县| 临桂县| 合阳县| 孟连| 铁岭市| 鄂尔多斯市| 金寨县| 闽侯县| 南京市| 婺源县| 偃师市| 信宜市| 虞城县| 龙岩市| 涿鹿县| 阜阳市| 治多县| 宁都县| 苏尼特右旗| 茂名市| 搜索|