分享
 
 
 

Oracle数据库-PL/SQL整理(1)

王朝oracle·作者佚名  2006-11-24
窄屏简体版  字體: |||超大  

--获取系统记录行数

go_block('T_WARITEMPRT');

last_record;

row_count:=:system.trigger_record; --system.cursor_record

--execute_trigger('POST-CHANGE');

--设置鼠标状态

set_application_property(cursor_style,'BUSY');

--raise form_trigger_failure;

--显示错误信息

exception when others then

display_note(sqlerrm||sqlcode,:global.logon_user);

--decode

decode(a.freightmode,'0','企业自付','1','供应商付费','2','企业代付','3','供应商代付',null)

decode(qtyonhand - qtyinit,invtranqty,invtranqty,null)

--导出路径

select * from t_parameter where f_name='LeanERPTempDir';

select f_c_value from t_parameter where f_name ='WebServer1';

--合同附件

select f_c_value from t_parameter where f_name='purorderaccesspath';

select f_c_value from t_parameter where f_name='purorderaccessurl';

--设置值列表

SET_ITEM_PROPERTY('top.ORIGINALNO',LOV_NAME,'LOV_MSO');

LIST_VALUES;

--下拉列表

n:=populate_group('rec_lb');

populate_list('BLK_BUT.APPTYPE','rec_lb');

:bLK_BUT.APPTYPE:='0';

--调用另一模块

DECLARE

pl_id ParamList;

v_string varchar2(1000);

v_itemname varchar2(1000);

BEGIN

pl_id := Get_Parameter_List('calendar');

IF NOT Id_Null(pl_id) THEN

Destroy_Parameter_List(pl_id);

END IF;

pl_id := Create_Parameter_List('calendar');

v_itemname:=:system.current_block||'.'||:system.current_item;

v_string:=name_in(v_itemname);

Add_Parameter(pl_id, 'p_str',TEXT_PARAMETER,v_string);

Call_Form('input_str',no_hide,no_replace,no_query_only,pl_id);

copy(:global.str,v_itemname); Erase(:global.str);

END;

--批量处理

set_application_property(cursor_style,'BUSY');

SYNCHRONIZE;

first_record;

loop

null;

exit when :system.last_record = 'TRUE';

next_record;

end loop;

set_application_property(cursor_style,'DEFAULT');

bell;

display_note('SRMP035',:global.logon_user);

-- 采购计划关闭完毕!

--对话框

IF display_stop('INV081', :GLOBAL.logon_user) <> alert_button1 THEN

RETURN;

END IF;

--取得货币名称

begin

select currencydesc

into v_currencydesc

from t_currency

where currencycode = c1.splymoneyflag;

exception when others then v_currencydesc := '人民币(元)';

end;

--询问对话框-1

declare

return_value number;

begin

set_alert_property('stop_alert',alert_message_text,'确认送审该合同吗?');

return_value := show_alert('stop_alert');

if return_value != alert_button1 then

return;

end if;

end;

--询问对话框-2

DECLARE

return_value number;

BEGIN

return_value := display_stop('mdm011',:global.logon_user);

IF return_value = ALERT_BUTTON1 THEN

COMMIT_FORM;

END IF;

END;

--取下周一

select trunc(sysdate,'d')+8 from dual;

--message_level

oldmsg := :System.Message_Level;

IF reldef = 'FALSE' THEN

Go_Block(detail);

Check_Package_Failure;

:System.Message_Level := '10';

Execute_Query;

:System.Message_Level := oldmsg;

ELSE

--取当前年度、期段号

begin

select year,period

into v_year,v_period

from t_accperiod

where sysdate >= startdate

and to_char(sysdate,'yyyy/mm/dd')<=to_char(enddate,'yyyy/mm/dd');

exception when others then null;

end;

--设置画布属性

vCan2:=FIND_VIEW('CAN_PRTNO2');

SET_VIEW_PROPERTY(vCan2,VISIBLE,property_true);

vCan1:=FIND_VIEW('CAN_PRTNO1');

SET_VIEW_PROPERTY(vCan1,VISIBLE,property_false);

--设备提示信息

elsif :top.opsrc = 'X' or :top.opsrc='T' then

set_item_property('top.tranobj',prompt_text,'客户代码');

else

set_item_property('top.tranobj',prompt_text,'部门代码');

end if;

--设置值列表KEY-LISTVAL

ELSIF :top.OPSRC='I' THEN --零星出库

SET_ITEM_PROPERTY('top.ORIGINALNO',LOV_NAME,'LOV_MSI');

LIST_VALUES;

IF :top.ORIGINALNO IS NOT NULL THEN

PRTNO_MSI;

END IF;

END IF;

--调用值列表show_lov

DECLARE

a_value_chosen BOOLEAN;

BEGIN

a_value_chosen := Show_Lov('lov_name');

IF a_value_chosen THEN

set_block_property('t_efficiency',default_where,'username = :control.display_name');

go_block('t_efficiency');

execute_query;

set_block_property('t_efficiency',default_where,'username in (select username from t_hrmuser where department = :global.user_dept)');

END IF;

END;

--生成序号

declare

vlpadnum number;

maxno varchar2(6);

cursor cerpcode is select sequence,lpadnum from t_erpcode

where erpcode='PURAPPNO' and prifix=to_char(sysdate,'yy')||to_char(sysdate,'mm') for update nowait;

begin

if :t_purapp.appno is null then

if :SYSTEM.MODE = 'NORMAL' THEN

begin

begin

for c1 in cerpcode loop

update t_erpcode set sequence=sequence+1 where erpcode='PURAPPNO' and prifix=to_char(sysdate,'yy')||to_char(sysdate,'mm');

end loop;

exception

when others then

display_note('SYS071',:global.logon_user);

raise form_trigger_failure;

end;

select sequence,lpadnum into maxno,vlpadnum from t_erpcode where erpcode='PURAPPNO' and prifix=to_char(sysdate,'yy')||to_char(sysdate,'mm');

exception

when NO_DATA_FOUND then

select count(*)+1 into maxno from t_purapp where appno like '%'||to_char(sysdate,'yy')||to_char(sysdate,'mm')||'%';

--select max()

vlpadnum:=4;

insert into t_erpcode(erpcode,prifix,sequence,lpadnum)

values ('PURAPPNO',to_char(sysdate,'yy')||to_char(sysdate,'mm'),maxno,vlpadnum);

end;

:t_purapp.appno := 'Q'||:global.logon_user||to_char(sysdate,'yy')||to_char(sysdate,'mm')||lpad(maxno,vlpadnum,'0');

end if;

end if;

end;

--遍历树

select t_prtstrudef.prtno,

t_prtbasdef.prtdesc,

t_prtbasdef.mtltmrk,

t_prtstrudef.prtpqty,

t_prtbasdef.prtum,

t_prtstrudef.tranprtno

from t_prtstrudef,t_prtbasdef

where t_prtstrudef.prtno = t_prtbasdef.prtno

connect by prior t_prtstrudef.prtno=t_prtstrudef.prntno

start with t_prtstrudef.prntno=:BLOCK_BUTTON.PRTNO;

--

/*

** Built-in: FORMS_DDL

** Example: The expression can be a string literal.

*/

BEGIN

Forms_DDL('create table temp(n NUMBER)');

IF NOT Form_Success THEN

Message ('Table Creation Failed');

ELSE

Message ('Table Created');

END IF;

[1] [2] [3] 下一页

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有