- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
PL-SQL(存储过程培训)
Programming in Oracle with PL/SQL PL/SQL Allows using general programming tools with SQL, for example: loops, conditions, functions, etc. This allows a lot more freedom than general SQL, and is lighter-weight than JDBC. We write PL/SQL code in a regular file, for example PL.sql, and load it with @PL in the sqlplus console. PL/SQL Blocks PL/SQL code is built of Blocks, with a unique structure. There are two types of blocks in PL/SQL: Anonymous Blocks: have no name (like scripts) can be written and executed immediately in SQLPLUS can be used in a trigger 2. Named Blocks: Procedures Functions Anonymous Block Structure: DECLARE (optional) /* Here you declare the variables you will use in this block */ BEGIN (mandatory) /* Here you define the executable statements (what the block DOES!)*/ EXCEPTION (optional) /* Here you define the actions that take place if an exception is thrown during the run of this block */ END; (mandatory) / DECLARE Declaring Variables with the %TYPE Attribute Examples Declaring Variables with the %ROWTYPE Attribute Declare a variable with the type of a ROW of a table. And how do we access the fields in reserves_record? Creating a PL/SQL Record A record is a type of variable which we can define (like ‘struct’ in C or ‘object’ in Java) Creating a Cursor We create a Cursor when we want to go over a result of a query (like ResultSet in JDBC) Syntax Example: DECLARE cursor c is select * from sailors; sailorData sailors%ROWTYPE; BEGIN open c; fetch c into sailorData; Example DECLARE Pi constant NUMBER(8,7) := 3.1415926; area NUMBER(14,2); cursor rad_cursor is select * from RAD_VALS; rad_value rad_cursor%ROWTYPE; BEGIN open rad_cursor; fetch rad_cursor into rad_val; area:=pi*power(rad_val.radius,2); insert into AREAS values (rad_val.radius, area); close rad_cursor; END; / DECLARE … cursor rad_cursor is select * from RAD_VALS; rad_value rad_cursor%
您可能关注的文档
最近下载
- DB 14T 2122—2020地质灾害调查规范.pdf VIP
- 高速铁路的养护维修—高铁精密测量控制网.pptx
- 俄语学法指导八年级全一册答案.doc VIP
- 4.6线段的垂直平分线(第1课时线段垂直平分线的性质定理及逆定理)(教学课件)-2025-2026学年八年级数学上册(湘教版2024).pptx
- 卫星互联网行业报告:卫星互联网建设与应用.pptx VIP
- 石油和天然气开采钻井井场设备设施安全事故隐患排查清单.pdf VIP
- 09SMS202-1埋地矩形雨水管道及其附属构筑物(混凝土模块砌体)清晰版建筑工程图集 .docx VIP
- ..物质由微观粒子构成.资料.ppt
- TGSS型水平刮板输送机.doc VIP
- 医学ppt--肥胖心血管疾病.ppt VIP
文档评论(0)