ORACLE 杂记
--获取系统记录行数
go_block('T_WARITEMPRT');
last_record;
row_count:=:system.trigger_record; --system.cursor_record
--execute_trigger('POST-CHANGE');
--设置鼠标状态
set_application_property(cursor_style,'BUSY'); 忙碌状态
set_application_property(cursor_style,'DEFAULT'); 正常状态
--设置值列表
SET_ITEM_PROPERTY('top.ORIGINALNO',LOV_NAME,'LOV_MSO');
--下拉列表
n:=populate_group('rec_lb');
populate_list('BLK_BUT.APPTYPE','rec_lb');
:bLK_BUT.APPTYPE:='0';
--批量处理
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);
--取下周一
select trunc(sysdate,'d')+8 from dual;
--设置画布属性
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;
--警报窗口
set_alert_button_property('edit_alert',alert_button1,label,'是(Y)');
set_alert_button_property('edit_alert',alert_button2,label,'否(Y)');
set_alert_property('edit_alert',alert_message_text,'是否修改已确认的配方信息?');
set_alert_property('edit_alert',title,'询问');
I:=show_alert('edit_alert');
if I=alert_button1 then
--设置值列表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;
END;
--物料所属大类判断
and (exists (select ''a'' from t_prtinclass c where c.classid='''||:blk_query.classid||''' and c.prtno=v_totqry.prtno ) or :blk_query.classid is null)
--给值列表赋初值
declare
cursor v_cur2 is select machtype A ,machtype B from t_gkdept order by machtype;
N_INDEX NUMBER :=1;
begin
DELETE_LIST_ELEMENT('T_TPMSCKMTN.MACHTYPE',1);
for c2 in v_cur2 loop
Add_List_Element('T_TPMSCKMTN.MACHTYPE',N_INDEX,C2.A,C2.B);
N_INDEX := N_INDEX + 1;
end loop;
end;
--
--查询重复数据
select rpno from t_purtrace group by rpno having count(rpno) >18;
--
--生成单据号
PROCEDURE GET_PRTNO is
v_sysdate varchar2(12);
v_Svdictateno varchar2(24);
v_DbodNo varchar2(12);
n_count integer;
v_count varchar2(10);
n_count1 integer;
n_count2 integer;
v_count2 varchar2(10);
n_num number;
v_num varchar2(8);
BEGIN
v_DbodNo:= 'ZS';
v_sysdate:=to_char(sysdate,'YYMMDD');
--获取满足条件的记录数
select count(*)+1 into n_num
from bas_prtbasdef
where prtno like v_DbodNo||v_sysdate||'%';
v_num := to_char(n_num);
--填充
v_count:=lpad(v_num,'5','0');
--合成为物料号
v_Svdictateno:=v_DbodNo||v_sysdate||v_count;
--判断是否存在该号码
select count(*) into n_count from bas_prtbasdef
where prtno=v_Svdictateno;
--不存在
if n_count=0 then
--把新物料号赋给参数p_prtno
:parameter.p_prtno := v_Svdictateno;
--若存在
elsif n_count>0 then
--递增
n_count1:=v_count+1;
loop
v_count2:=lpad(n_count1,'5','0');
v_Svdictateno:=v_DbodNo||v_sysdate||v_count2;
select count(*) into n_count2 from bas_prtbasdef
where prtno=v_Svdictateno;
if n_count2=0 then
:parameter.p_prtno := v_Svdictateno;
exit;--退出循环
end if;
n_count1:=n_count1+1;
end loop;
end if;
exception when others then
display_note(sqlerrm||sqlcode,:global.logon_user);
END;
--
--当保存记录时控制:同一物料质量编号不能相同。
DECLARE
row_count NUMBER; --记录行数
row_num number; --所新建或修改记录行数
V_PRTLOTNO t_srmchkproject.prtlotno%type; --质量编号
BEGIN
--获取当前记录行数
row_num := :system.trigger_record;
first_record;
loop
row_count:=:system.trigger_record;
V_PRTLOTNO := :t_srmchkproject.prtlotno;
GO_RECORD(ROW_COUNT + 1);
loop
--若质量编号相同
if v_prtlotno = :t_srmchkproject.prtlotno then
display_note('同种物料的质量编号不能相同!请改正。',:global.logon_user);
go_item('t_srmchkproject.prtlotno');
return;--返回
--exit;
end if;
exit when :system.last_record = 'TRUE';
next_record;
end loop;
GO_RECORD(ROW_COUNT+1); --用以最后一行记录判断
exit when :system.last_record = 'TRUE';
--返回外层循环记录
GO_RECORD(ROW_COUNT);
next_record;
end loop;
commit_form;
--返回当前记录
go_record(row_num);
EXCEPTION WHEN OTHERS THEN NULL;
END;
--
--自动定位树结构的焦点
DECLARE
htree item;
find_node Ftree.NODE;
begin
htree:= Find_Item('T_BOM1.BOM');
find_node := FTREE.FIND_TREE_NODE(htree,:T_PRTBASDEF_CREATE.PRTNO,FTREE.FIND_NEXT,FTREE.NODE_VALUE,FTREE.ROOT_NODE,FTREE.ROOT_NODE);
IF NOT Ftree.ID_NULL(find_node) then --如果存在对应的节点
--pause;
FTREE.SET_TREE_SELECTION(htree, FIND_NODE, FTREE.SELECT_TOGGLE);
end if;
end;
--
--杀死死进程
select SID, serial#, USERNAME, SCHEMANAME, STATUS, OSUSER, OSUSER,TERMINAL, PROGRAM, LOGON_TIME from v$session;
ALTER SYSTEM KILL SESSION '';
--
select func.DECODEPASSWD(password) from t_user where username = '';
select func.ENCODEPASSWD(password) from t_user where username = '';
--用户权限
(:GLOBAL.LOGON_USER in (select object from t_roleuser where role=MODIFER and flag='0') or MODIFER=:GLOBAL.LOGON_USER)
--
--列表项
DECLARE
v_n Number;
BEGIN
v_n := populate_group('rec_ptype');
populate_list('t_freesb.prntno','rec_ptype');
END;
--提示对话框
set_alert_property('note_alert',alert_message_text,'口令更改成功!');
return_value := show_alert('note_alert');
--
--改变按钮标签文本
DECLARE
v_Count NUMBER;
v_Label VARCHAR2(100);--记录“全选按钮”的标签文本
BEGIN
Go_Block('user_col_comments');
v_Label := Get_Item_Property('Blk_Control.Btn_Select_Col', Label);
First_Record;
IF v_Label = '+' THEN
LOOP
/*SELECT COUNT(*)
INTO v_Count
FROM t_Fieldrole
WHERE Table_Name = :User_Col_Comments.Table_Name
AND Column_Name = :User_Col_Comments.Column_Name
AND Role = :t_Fieldrole.Role;*/
--IF v_Count = 0 THEN
:User_Col_Comments.Chk_Select := 1;
--END IF;
EXIT WHEN :System.Last_Record = 'TRUE';
NEXT_RECORD;
END LOOP;
First_Record;
Set_Item_Property('Blk_Control.Btn_Select_Col', Label,'-');
Set_Item_Property('Blk_Control.Btn_Select_Col', TOOLTIP_TEXT,'取消选择');
ELSIF v_Label = '-' THEN
First_Record;
LOOP
:User_Col_Comments.Chk_Select := 0;
EXIT WHEN :System.Last_Record = 'TRUE';
NEXT_RECORD;
END LOOP;
First_Record;
Set_Item_Property('Blk_Control.Btn_Select_Col', Label,'+');
Set_Item_Property('Blk_Control.Btn_Select_Col', TOOLTIP_TEXT,'选取全部');
END IF;
EXCEPTION
WHEN OTHERS THEN
NULL;
END;
--
--触发器失效
Forms_Ddl('alter trigger cascade_warprt_qty disable');
alter table t_Prthiswarinv disable all triggers;
alter table t_Prthiswarinv enable all triggers;
alter table T_PURORDER disable all triggers;
alter table T_PURORDER enable all triggers;
--
--注意null与任何值比较皆为空。
select decode(instr(null,'a'),0,0,null,2,1) from dual;
--抛出错误
Raise_Application_Error(-20100,
:New.Prtno ||
'已经登帐的库存事务不能删除,必须进行调错处理!');
--不同用户之间共享数据
--在cpc下
grant select on T_LACKITEM to jh7;
revoke select on T_LACKITEM from jh7;
--在jh7下
create table t_lackitem as select * from cpc.t_lackitem
--在form中创建后台job
DECLARE
Alert_Button NUMBER;
v_Job NUMBER;
BEGIN
Alert_Button := Display_Stop('是否确认结转全部库房?',
:Global.Logon_User);
--是否确认对截至日期内所选定库房的流水进行转移?
IF Alert_Button <> Alert_Button1 THEN
--raise form_trigger_failure;
RETURN;
END IF;
v_Job := 489;
Sys.Dbms_Job.Submit(v_Job,
'cpcfcpgen;',
SYSDATE + 1 / (24 * 60),
'sysdate + 1000');
COMMIT;
Go_Item('t_mo.mono');
Set_Item_Property('GEN_MRP.CONTINUE', Enabled, Property_False);
Message('有限能力计划将在一分钟后开始生成,请耐心等待……');
EXCEPTION
WHEN OTHERS THEN
Display_Note(SQLCODE || SQLERRM, :Global.Logon_User);
END;
--获取查询条件
Tmp_Query01 := Get_Block_Property('T_PK', Last_Query);
--查找某库房、物料最后一条流水
--
create or replace view v_prtio as
Select invtranno,substr(invtranno,1,4)invtran,invstatus,prtno,warno,wardate,qtyonhand,1 columnno
From t_prtio
--
Select invtranno
From (Select invtranno,
prtno,
Sum(columnno) over(Partition By prtno,warno Order By wardate Desc,substr(invtranno,instr(invtranno,'0'))desc,Rowid Desc ) n
From v_prtio)
Where n = 1
--查找流水错误(当前库存数量与台帐不一致)
Select a.prtno,invtranno From (Select invtranno, prtno,warno,qtyonhand From t_prtio Where invtranno In(Select invtranno From (Select invtranno, prtno,Sum(columnno) over(Partition By prtno,warno Order By wardate Desc,substr(invtranno,instr(invtranno,'0'))desc,Rowid Desc ) n From v_prtio Where ((invtran = 'JZRK' And qtyonhand != 0 ) Or (invtran != 'JZRK'))And invstatus != 'B') Where n = 1))a,t_warprt b Where a.prtno = b.prtno And a.warno = b.warno And a.qtyonhand != b.onhandqty;
--用Sql语句实现查找一列中第N大值
--
select * from
(select t.*,dense_rank() over (order by sal) rank from employee)
where rank = N;
--
select * from
(select prtno,dense_rank() over (order by qtyonhand) n,qtyonhand from t_prtio)
Where n = 1
--
--查询2005年全年日期
select to_date('20050101','yyyymmdd')+rownum-1
from all_objects
where rownum <= to_char(to_date('20051231','yyyymmdd'),'ddd');
--
--判断是否可以输入
DECLARE
pl_id ParamList;
v_string varchar2(1000);
v_itemname varchar2(1000);
enter_enabled VARCHAR2(100); --是否可以输入
BEGIN
v_itemname:=:system.current_block||'.'||:system.current_item;
enter_enabled:=get_item_property(v_itemname,ENTERABLE);
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_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);
if enter_enabled='TRUE' then
copy(:global.str,v_itemname);
else
null;
END IF;
Erase(:global.str);
END;
--保持同步
Synchronize;
--更新配套单状态
declare
cursor c_pk is select pkno from t_pk;
begin
for c_1 in c_pk loop
update t_pkitem2 set pkno=pkno where pkno=c_1.pkno
and rownum = 1;
end loop;
end;
--游标变量
declare
type v_cursor is ref cursor;
cur_pknew v_cursor;
begin
if :blk_pk.pkrule=1 then
open cur_pknew for select ……
elsif :blk_pk.pkrule=2 then
open cur_pknew for select ……
end if;
loop
fetch cur_pknew into ……
exit when cur_pknew%notfound;
end loop;
close cur_pknew;
end;
--转移数据
DECLARE
sql_cursor integer;
retu integer;
n_position integer;
n_len integer;
button_value number;
v_where varchar2(1000):= :system.last_query;
BEGIN
set_alert_property('stop_alert',alert_message_text,
'确认把监控记录导入到历史数据库?导出后,当前监控记录将被清空!');
bell;
button_value := show_alert('stop_alert');
IF button_value = alert_button1 then
n_position:= INSTR(v_where,'WHERE');
if n_position > 0 then
v_where := SUBSTR(v_where, n_position);
n_position:= INSTR(v_where,'order');
v_where := SUBSTR(v_where,1, n_position-1);
else
v_where := ' ';
end if;
message('正在导出到历史记录,请稍等...',NO_ACKNOWLEDGE);
sql_cursor := dbms_sql.open_cursor;
dbms_sql.parse(sql_cursor,'insert into t_monitor_his select * from t_monitor '||v_where,1);
retu := dbms_sql.execute(sql_cursor);
dbms_sql.parse(sql_cursor,'delete from t_monitor '||v_where,1);
retu := dbms_sql.execute(sql_cursor);
dbms_sql.close_cursor(sql_cursor);
commit work;
message('保存完毕!',NO_ACKNOWLEDGE);
go_block('t_monitor');
--clear_block;
execute_query;
END IF;
END;
--显示终端用户
select userenv('terminal') from dual;
--更新部门不一致的数据
Update jh7.lean_user a Set a.deptno=(Select
quality.t_user.deptno from quality.t_user Where
quality.t_user.username = a.username)
Where Exists (Select 'a' From quality.t_user Where username = a.username And deptno != nvl(a.deptno,'&'));
--块中项目的控制.
Declare
vItemName t_fundef.funcode%TYPE;
vFunflag varchar2(1);
vBlock varchar2(30);
BEGIN
vBlock := 'BLK_MPS';
vItemName := Get_Block_Property(vBlock,First_item);
WHILE ( vItemName IS NOT NULL ) LOOP
Begin
Select to_char(f_i_value) into vFunFlag From t_Parameter
Where f_name = vItemName;
IF vFunFlag = '0' then
if vItemName = 'MPSFPRMT' then
:BLK_MPS.MPSFPRMT := '0';
elsif vItemName = 'MPSFPRMT1' then
:BLK_MPS.MPSFPRMT1 := '0';
elsif vItemName = 'MPSEOMTN' then
:BLK_MPS.MPSEOMTN := '0';
elsif vItemName = 'SALORMTN' then
:BLK_MPS.SALORMTN := '0';
end if;
END IF;
Exception When NO_DATA_FOUND Then
null;
End;
vItemName := Get_Item_Property(vBlock||'.'||vItemName, NEXTITEM );
END LOOP;
exception
when others then
null;
END;
--example
FUNCTION Stat_Roll(p_Sign VARCHAR2) RETURN NUMBER IS
--月终统计
--vCurrentForm Varchar2(30);
Vblockname VARCHAR2(30);
Vitemname VARCHAR2(30);
v_Sumsign NUMBER := 0;
v_Sumroll NUMBER := 0;
v_Itemvalue VARCHAR2(3);
BEGIN
--vCurrentForm := upper(GET_APPLICATION_PROPERTY(CURRENT_FORM_NAME));
--vBlockName := upper(Get_Form_Property(vCurrentForm,First_Block));
Vblockname := 'T_ROLLBOOK';
--Vitemname := Upper(Get_Block_Property(Vblockname, First_Item));
Vitemname := 'DATE01';
WHILE (Vitemname IS NOT NULL) LOOP
v_Itemvalue := Name_In('T_ROLLBOOK' || '.' || Vitemname);
BEGIN
SELECT Decode(v_Itemvalue, p_Sign, 1, NULL, 0, 0)
INTO v_Sumsign
FROM Dual;
EXCEPTION
WHEN OTHERS THEN
v_Sumroll := 0;
END;
v_Sumroll := v_Sumroll + v_Sumsign;
IF Vitemname = 'DATE31' THEN
EXIT;
END IF;
Vitemname := Get_Item_Property(Vblockname || '.' || Vitemname, Nextitem);
END LOOP;
--vBlockName := Get_Block_Property( vBlockName, NEXTBLOCK );
RETURN v_Sumroll;
END;
--
--获取复选框的值
IF Checkbox_Checked(:SYSTEM.CURRENT_ITEM) THEN
null;
ELSE
NULL;
END IF;
--库存差错
SELECT *
FROM (SELECT Warno, SUM(Onhandqty * Prtlprc) Qty
FROM t_Waritemprt a, t_Prtbasdef b
WHERE a.Prtno = b.Prtno
GROUP BY a.Warno) g,
(SELECT Warno, SUM(Onhandqty * Prtlprc) Qty
FROM t_Warprt a, t_Prtbasdef b
WHERE a.Prtno = b.Prtno
GROUP BY a.Warno) b,
(SELECT Warno, SUM(Onhandqty * Prtlprc) Qty
FROM t_Prthisinvitem a, t_Prtbasdef b
WHERE a.year= 2005 And a.Period = '4' AND a.Prtno = b.Prtno
GROUP BY a.Warno) t
WHERE g.Warno = b.Warno AND g.Warno = t.Warno AND
(g.Qty != b.Qty OR g.Qty != t.Qty);
--查询子项皆为完成而主单仍为正常的申请单
Select appno From t_msi Where appno in(Select Distinct appno From t_msiitem Where appno in(Select appno From (Select appno,Count(Distinct appnoflag) counts From t_msiitem Group By appno) Where counts = 1) And appnoflag = '4') And msiflag = '0'
--动态构造值列表
DECLARE
rg_name VARCHAR2(40) := 'group_VALUE';
rg_id RecordGroup;
lov_id LOV;
errcode NUMBER;
V_Counts number;
BEGIN
/* ** Make sure group doesn't already exist */
rg_id := Find_Group(rg_name);
/* ** If it exist, delete it. */
IF NOT Id_Null(rg_id) THEN
Delete_Group( rg_id );
END IF;
/*create it and add the two ** necessary columns to it. */
--IF :T_ROLEOPERATE.fieldname = 'GLOODGROUP' THEN
SELECT COUNT(*) INTO v_Counts FROM T_listval where flags = :T_ROLEOPERATE.fieldname;
IF V_Counts >= 1 THEN
rg_id := Create_Group_From_Query(rg_name,
'SELECT distinct '||:T_ROLEOPERATE.fieldname||' value ' ||
' from t_hrmuser');
--SET_ITEM_PROPERTY('T_ROLEOPERATE.fieldname',LOV_NAME,'LOV_VALUE');
ELSE
rg_id := Create_Group_From_Query(rg_name,
'SELECT distinct '||:T_ROLEOPERATE.fieldname||' value ' ||
' from t_hrmuser');
--SET_ITEM_PROPERTY('T_ROLEOPERATE.fieldname',LOV_NAME,'');
END IF;
lov_id := Find_LOV('LOV_VALUE');
errcode := Populate_Group( rg_id );
Set_LOV_Property(lov_id,GROUP_NAME,'group_VALUE');
:T_Roleoperate.Value := null;
EXCEPTION WHEN others then
display_note(sqlcode||sqlerrm, :global.logon_user);
END;
--调用的FORM仅允许查询。
CALL_FORM('Hrmmenmtn',no_hide,no_replace,query_only,pl_id);
--赋初始值
Default_Value( '0', ptr_name );
--要找到某月中所有周五的具体日期
select to_char(t.d,'YY-MM-DD') from (
select trunc(sysdate, 'MM')+rownum-1 as d
from dba_objects
where rownum < 32) t
where to_char(t.d, 'MM') = to_char(sysdate, 'MM') --找出当前月份的周五的日期
and trim(to_char(t.d, 'Day')) = '星期五'
--------
03-05-02
03-05-09
03-05-16
03-05-23
03-05-30
如果把where to_char(t.d, 'MM') = to_char(sysdate, 'MM')改成sysdate-90,即为查找当前月份的前三个月中的每周五的日期。
--rownum的用法:
只能用以上符号(<、<=、!=)。
select * from tablename where rownum != 10;返回的是前9条记录。
不能用:>,>=,=,Between...and。由于rownum是一个总是从1开始的伪列,Oracle 认为这种条件 不成立,查不到记录.
另外,这个方法更快:
select * from (
select rownum r,a from yourtable
where rownum <= 20
order by name )
where r > 10
这样取出第11-20条记录!(先选再排序再选)
要先排序再选则须用select嵌套:内层排序外层选。
rownum是随着结果集生成的,一旦生成,就不会变化了;同时,生成的结果是依次递加的,没有1就永远不会有2!
rownum 是在 查询集合产生的过程中产生的伪列,并且如果where条件中存在 rownum 条件的话,则:
1: 假如 判定条件是常量,则:
只能 rownum = 1, <= 大于1 的自然数, = 大于1 的数是没有结果的, 大于一个数也是没有结果的
即 当出现一个 rownum 不满足条件的时候则 查询结束 this is stop key!
2: 当判定值不是常量的时候
若条件是 = var , 则只有当 var 为1 的时候才满足条件,这个时候不存在 stop key ,必须进行 full scan ,对每个满足其他where条件的数据进行判定
选出一行后才能去选rownum=2的行……
--显示图片 READ_IMAGE_FILE
declare
VHOME VARCHAR2(100);
begin
vhome := :GLOBAL.VHOME;
READ_IMAGE_FILE(vhome||'PICMENU_MOVE.BMP','BMP','BLK_USERMENU_EDIT.IMG_SHOW');
end;