您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

用脚本调用Oracle存储过程

2024/6/14 18:22:42发布40次查看
先准备好一个sql脚本demo.sql set serveroutput ondeclarev_name dept.dname%type;beginselect dname into v_name from dept whe
先准备好一个sql脚本demo.sql
set serveroutput on
declare
v_name dept.dname%type;
begin
select dname into v_name from dept where deptno=&1;
dbms_output.put_line('department name is: '||v_name);
end;
/
exit;
然后在终端下执行:
sqlplus scott/tiger@orcl @demo.sql 20
返回:
sql*plus: release 9.2.0.4.0 - production on thu oct 17 21:37:28 2013
copyright (c) 1982, 2002, oracle corporation. all rights reserved.
connected to:
oracle9i enterprise edition release 9.2.0.4.0 - production
with the partitioning, olap and oracle data mining options
jserver release 9.2.0.4.0 - production
old 4: select dname into v_name from dept where deptno=&1;
new 4: select dname into v_name from dept where deptno=20;
department name is: research
pl/sql procedure successfully completed.
disconnected from oracle9i enterprise edition release 9.2.0.4.0 - production
with the partitioning, olap and oracle data mining options
jserver release 9.2.0.4.0 - production
注意:我们可以给脚本传参数,,在脚本中用&1,&2这样的参数
本文永久更新链接地址:
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product