createorreplacepackagepack1--创建包头/规范
is
aanumber:=1;--在包头声明的为公有变量
procedureupdate_student(update_rowinstudent%rowtype);--声明一个更新过程
procedureinsert_student(insert_rowinstudent%rowtype);--声明一个插入过程
endpack1;--结束包头
--Package created
createorreplacepackagebodypack1--创建包体/主体
is
bbnumber:=2;--在包体声明的变量类私有变量
procedureinsert_student(insert_rowinstudent%rowtype)--创建过程主体
as
begin
insertintostudent(id,name,age)values(insert_row.id,insert_row.name,insert_row.age);
dbms_output.put_line('bb = '||bb||'aa = '||aa);
endinsert_student;--结束过程主体
procedureupdate_student(update_rowinstudent%rowtype)--创建过程主体
as
begin
updatestudent ssets.name='赵北'wheres.id=update_row.id;
endupdate_student;--结束过程主体
endpack1;--结束主体/包体
--Warning: Package body created with compilation errors
SQL>showerror;--查询错误
ErrorsforPACKAGEBODYHR.PACK1:
LINE/COLERROR
----------------------------------------------------------------------------
5/1PLS-00103:出现符号
"BEGIN"在需要下列之一时:;iswithauthidas
clusterorderusingexternaldeterministicparallel_enable
pipelinedresult_cache 符号 ";" 被替换为 "BEGIN" 后继续。
10/3PLS-00103:出现符号
"PROCEDURE"
11/5PLS-00103:出现符号
"BEGIN"在需要下列之一时:;iswithauthidas
clusterorderusingexternaldeterministicparallel_enable
pipelinedresult_cache 符号 ";" 被替换为 "BEGIN" 后继续。
SQL>
SQL>ed--修改上次执行的代码块
SQL>/--执行修改的代码块
--Package body created
SQL>setserverouton;--打开输出开关
SQL>executedbms_output.put_line(pack1.aa);--包中的公共变量被输出
1
PL/SQLproceduresuccessfully completed
SQL>executedbms_output.put_line(pack1.bb);--包中的私有变量不被输出
begindbms_output.put_line(pack1.bb);end;
--ORA-06550: 第 1 行, 第 34 列:
--PLS-00302: 必须声明 'BB' 组件
--ORA-06550: 第 1 行, 第 7 列:
--PL/SQL: Statement ignored
declare
row_student student%rowtype;--声明行级变量
begin
row_student.id:=5;
row_student.name:='张飞';
row_student.age:=60;
pack1.insert_student(row_student);--调用包中的过程
end;
/
bb=2aa=1
PL/SQLproceduresuccessfully completed
SQL>select*fromstudent;
IDNAME AGE
----------- -------------------- -----------
1张三20
2李四25
3王五30
4麻子30
5张飞60
SQL>
declare
row_student student%rowtype;--声明行级变量
begin
row_student.id:=5;
row_student.name:='关羽';
row_student.age:=60;
pack1.update_student(row_student);--调用包中的过程
end;
/
PL/SQLproceduresuccessfully completed
SQL>select*fromstudent;
IDNAME AGE
----------- -------------------- -----------
1张三20
2李四25
3王五30
4麻子30
5赵北60
|
相关推荐
数学建模matlab算法程序包汇总
C51单片机 项目1-P0口驱动LED闪烁 (仿真文件+程序包)C51单片机 项目1-P0口驱动LED闪烁 (仿真文件+程序包)C51单片机 项目1-P0口驱动LED闪烁 (仿真文件+程序包)C51单片机 项目1-P0口驱动LED闪烁 (仿真文件+程序...
SVN安装程序包64位
DS-78 88NB-Kx系列V3.4.110 build 200108程序包 软件名称:DS-78 88NB-Kx系列新版程序包 程序包适用于以下型号: DS-78xxNB-K1、DS-78xxNB-K1/C、DS-78xxNB-K2 DS-88xxNB-K8、DS-78xxNB-K1/xP、DS-78xxNB-K2/xP ...
jquery效果程序包,jquery效果程序包,jquery效果程序包
老二牛车教育程矢第七章上机课子程序和程序包.pdf
ORACLE中的程序包.ppt
主要介绍了IDEA2020.1启动SpringBoot项目出现java程序包:xxx不存在,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧
emd程序包,最全的emd程序,最经典的经验模式分解程序,信号处理学习必备
EMD分析的matlab程序包
解决卸载office2007安装程序包的语言不受系统支持的工具
本人鉴于网上五花八门的对zip文件的操作,特地制作一个处理zip的程序包,包含功能较为完整的解压和压缩功能。 内有简单文档说明。
windows installer 程序包(B1530A instrument library程序包下载)
网络连接不上?用用这个Windows疑难解答程序包吧,他会帮你解决一些问题的。
pc端微信小程序包wxapkg文件解密,nodejs版本。
oracle子程序和程序包(主要对oracle存储过程和函数作了讲解),里面有详细的例子。
matlab神经网络算法的程序包,包含各种运用
C++程序包,安心下载,本人也在用。费力收集 C++程序包,安心下载,本人也在用。费力收集
乐华LT.V56.03程序包
C++实用程序包 utility.h 常用头文件等。