`
maosheng
  • 浏览: 560351 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

PL SQL开发指导

    博客分类:
  • DB
 
阅读更多

1. Use the correct datatype so that implicit conversion will be avoided

2. Use bind variable to avoid unnecessary parsing

3. Use BULK COLLECT, % ATTRIBUTES wherever required

4. Use WHEN OTHERS exception as the last resort and handle exceptions

5. Use %TYPE and %ROWTYPE attributes. No code change is required when schema structure changes

6. Write as Little Code as Possible

7. Synchronize Program and Data Structures

8. Center All Development Around Packages

9. Don't declare data in your package specification

10. Avoid writing repetitive code inside your package bodies

11. Never exit from a FOR or WHILE LOOP (cursor) with an EXIT or RETURN statement

12. Don't let functions have OUT or IN OUT parameters

13. Do not use exceptions to perform branching logic

14. Do not " SELECT COUNT(*)“

15. Do not use the names of tables or columns for variable names

16. Walk through each other’s code

17. Adapt a consistent, readable format that is easy to maintain

18. Adapt logical, consistent naming conventions for modules and data structures

19. Standardize module and program headers

20. Tag module END statements with module names

21. Name procedures with verb phrases and functions with noun phrases

22. Self-document using block and loop labels

23. Express complex expressions unambiguously using parentheses

24. Use vertical code alignment to emphasize vertical relationships

 

25. Comment tersely with value-added information

26. Adopt meaningful naming conventions for source files

27. Use CONSTANT declarations for variables whose values do not change

28. Perform complex variable initialization in the executable section

29. Replace complex expressions with Boolean variables and functions

30. Remove unused variables and code

31. Beware of and avoid implicit datatype conversions

32. Package application-named literal constants together

33. Centralize TYPE definitions in package specifications

34. Use package globals judiciously and only in package bodies

35. Move static expressions outside of loop and SQL statements

36. Set guidelines for application-wide error handling before you start coding

37. Catch all exceptions and convert to meaningful return codes before returning to non-PL/SQL host programs

38. Use your own raise procedure in place of explicit calls to RAISE_APPLICATION_ERROR

39. Use WHEN OTHERS only for unknown exceptions that need to be trapped

40. Standardize named application exceptions in package specifications

41. Use incremental COMMITs to avoid rollback segment errors when changing large number of rows

42. Define multi-rows cursors in packages so they can be used for multiple programs

43. Fetch into cursor records, never into a hard-coded list of variables

44. Use COUNT only when the actual number of occurrences is needed

45. Use a cursor FOR loop to fetch all rows in a cursor unconditionally and never use to fetch just one row

46. Specify columns to be updated in a SELECT FOR UPDATE statement

47. Reference cursor attributes immediately after executing the SQL operation

48. Use FORALL to improve performance of collection-based DML

 

49. Never return NULL from Boolean functions

50. Minimize the size of the trigger execution sections

51. Implement server problem logs and “to do” lists using database triggers

52. Validate complex business rules with DML triggers

53. Freeze and build package specifications before implementing package bodies

54. Handle expected and named exceptions when perforiming file I/O

55. Soft-code directory names in your calls to UTL_FILE.FOPEN

56. Backup/Purge process should be done periodically

57. Database health check-up must be performed periodically and if required, it is necessary to resize the database files appropriately

58. Instead of having the full code in a Program or Routine, should split the code into multiple sub Paragraphs which will increase the code readability.

 

 

 

 

 

分享到:
评论

相关推荐

    PL/SQL开发文档1

    标题中提到的“PL/SQL开发文档1”,说明本文档是关于PL/SQL开发的入门级指导材料,面向希望学习使用PL/SQL进行数据库程序单元开发的用户。文档很可能是Oracle公司内部或其授权的培训机构用于教学目的的官方材料。 ...

    pl/sql开发文档1

    文档内容涵盖了PL/SQL开发环境的介绍,详细地说明了如何在SQL*Plus和Oracle JDeveloper中编写PL/SQL代码。同时,文档提到了Oracle SQL Developer这一工具,这是一款图形界面的开发工具,可以简化数据库应用的开发,...

    pl sql 官方英文文档

    对于那些希望深入了解PL/SQL的开发者而言,Oracle官方文档是必不可少的学习资源,它为PL/SQL的开发和应用提供了全面的指导。官方文档中所包含的代码示例和最佳实践能够帮助开发者更有效地编写和维护高质量的数据库...

    pl/sql开发文档3

    文档标签为"pl/sql",说明这是针对PL/SQL开发的指导文档。文档中提到的关于OracleDB和PL/SQL基础学生指南的详细信息,如版本号、文档的版权声明、作者信息、免责条款以及商标声明,都是关于Oracle文档的规范性信息。...

    PL/SQL应用开发实训指导

    本实训指导针对PL/SQL在Oracle数据库中的应用开发进行深入讲解,旨在提升学员的实际操作能力和程序设计技巧。 首先,PL/SQL的基础知识是学习的关键。它由三部分组成:声明部分(DECLARATION)、执行部分(EXECUTION...

    Oracle PL/SQL专家指南-高级PL/SQL解决方案的设计与开发

    《Oracle PL/SQL专家指南-高级PL/SQL解决方案的设计与开发》是一本深入探讨Oracle数据库中的PL/SQL编程的专业书籍。PL/SQL是Oracle数据库特有的编程语言,它结合了SQL的查询能力与过程式编程语言的功能,使得数据库...

    Learning Oracle PL_SQL

    通过本书的学习,读者将能够理解PL/SQL的基本概念,掌握其核心语法和编程技巧,同时学会如何利用PL/SQL开发高效、安全的数据库应用程序,无论是在传统环境中还是在网络和互联网场景下。此外,书中提供的示例代码和...

    ORACLE PL/SQL从入门到精通

    ORACLE PL/SQL是从入门到精通的专业知识,涵盖了数据库开发与管理的多个方面,包括触发器、过程、函数、软件包、异常处理、游标、循环、分支、变量使用、数据库安装等关键知识点。 触发器是数据库中用来保证数据...

    PL_SQL Developer日志生成插件的开发与应用.pdf

    根据给定文件信息,以下知识点是关于“PL_SQL Developer日志生成插件的开发与应用”的详细解释: 1. 插件技术的应用背景: 随着计算机应用的发展,用户对软件功能的需求变得越来越具体和专业化。现有的软件在发布后...

    PL/SQL开发指南《自己写的》

    ### PL/SQL 开发指南概览 #### 序言 - 特点介绍 PL/SQL(Procedural Language for SQL)是由Oracle公司开发的一种过程化编程语言,它结合了...这本指南旨在为想要学习或使用PL/SQL的开发人员提供全面而深入的指导。

    Oracle9i: Program with PL/SQL 学生指导

    《Oracle9i: Program with PL/SQL 学生指导》是一本面向初学者的专业书籍,旨在帮助学生掌握如何使用PL/SQL编程语言进行Oracle9i数据库的开发与管理。本书分为多个章节,详细介绍了PL/SQL的基础知识、数据类型、流程...

    PL SQL(简洁、经典、入门)

    10. **索引与优化**:理解如何有效地使用索引以优化SQL查询性能是PL SQL开发中的重要一环。了解如何创建索引、分析索引效果和调整索引策略对数据库性能至关重要。 通过深入学习这些核心概念,你将能够熟练地运用PL ...

    精品资源:超全PL/SQL教程全集

    7. **PL/SQL开发环境配置** - **SQL*Plus**:Oracle提供的命令行工具,可以直接编写和执行PL/SQL代码。 - **Oracle SQL Developer**:图形化界面工具,提供更友好的开发环境,支持代码编辑、调试和数据库管理。 8...

    pl/sql 开发最佳实践

    ### PL/SQL 开发最佳实践 #### Oracle简介与发展历程 Oracle数据库系统由Oracle公司于1979年推出,标志着关系数据库管理系统(RDBMS)的诞生。它是一款跨平台的数据库解决方案,能够运行在从个人电脑到大型主机的...

    PL/SQL中文帮助手册

    这个"PL/SQL中文帮助手册"是7.0版本,对于理解和掌握PL/SQL编程具有极大的指导价值。 在PL/SQL中,主要包含以下核心概念: 1. **块结构**:PL/SQL程序的基本单元是块,包括声明部分、执行部分和异常处理部分。声明...

    PL/SQL Developer 插件

    PL/SQL Developer是一款专为Oracle数据库开发人员设计的集成开发环境(IDE),它提供了一整套工具来编写、调试、测试和优化PL/SQL代码。这个"shortcuts"插件是为了提升开发效率,通过快捷键的方式帮助用户快速输入...

    PL/SQL Developer11中文版

    解压后的文件可能包含详细的使用手册或快速入门指南,指导用户如何安装、配置和使用PL/SQL Developer 11中文版。按照这些说明操作,可以确保软件正常运行并充分发挥其功能。 9. **密码保护**: 压缩包设置了密码...

Global site tag (gtag.js) - Google Analytics