您的位置:首页 > 数据库

PLSQL 一般变量与替代变量

2014-03-18 00:00 330 查看
摘要: 一般变量与替代变量实例

--&变量名,&&变量名简析-----------------------------------------------------------

set verify on;
select * from tcpn_jodsmapping where productid = '&ProductID' and producteffdate = '&ProductEffdate'
ORDER by '&ProductID';

select * from tcpn_jodsmapping where productid = '&&ProductID' and producteffdate = '&ProductEffdate'
ORDER by '&ProductID';
-- ACCEPT-----------------------------------------------------------------------
ACCEPT pro_pID PROMPT 'Provide the Product ID and Eff date.'
select * from
tcpn_jodsmapping
where productid = '&pro_pID';
-------------------------------------------------------------------------------
--DEFINE-----------------------------------------------------------------------
DEFINE DEF010003=010003;
DEFINE DEF010003
DEFINE DEF01000320090301=20090301;
DEFINE DEF01000320090301

SELECT * FROM tcpn_paymentitem
where productid = '&DEF010003'
and PRODUCTEFFDATE = '&DEF01000320090301';

UNDEFINE DEF010003;
UNDEFINE DEF01000320090301;
--------------------------------------------------------------------------------
declare
v_sal number(6,2);
v_ename emp.ename%type:='&ename';
begin
select sal into v_sal from emp
where lower(ename)=lower(v_ename);
if v_sal<2000 then
update emp set sal=v_sal + 200
where lower(ename)=lower(v_ename);
end if;
end;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: