ºÝºÝߣ

ºÝºÝߣShare a Scribd company logo
Best Practices in PL/SQL
Why Do we Need to follow
Best Practices???
? Good practices help to ensure that code is
developed properly
? Best practices help to ensure that code is in a
maintainable fashion
3 M¡¯s *
*(? 1G)
SPOD
? SPOD is well known as ¡°Single Point of
definition¡±
? SPOD simply implies that define once and use
every where!!!!
? Therefore, developer does not need to repeat
the code.
Explicit Vs Implicit
? Use Explicit cursors as much as possible in
code.
? Avoid to use ¡®select¡¯ implicit cursor
? Nevertheless, Steven Feuerstein has
recommended to use implicit cursor in the
code.
? BUT in IFS context, ¡®Explicit¡¯ cursors are
recommended!!!
Avoid!!
? Avoid Hard coding
? Avoid to use VARCHAR2(N) declaration
? Avoid to use ¡®Literal¡¯ value. But, use
name%type or name%rowtype
Data encapsulation
Data encapsulation
? Hide business rules and formulas!
? Move blocks of complex code such as Function
and Procedure
? Write small, Narrowly focused code
easy to reuse package
Best Practice With PLSQL
Error Handling
? Handles the errors separately and have
package for that
THANK YOU

More Related Content

Best Practice With PLSQL

  • 2. Why Do we Need to follow Best Practices??? ? Good practices help to ensure that code is developed properly ? Best practices help to ensure that code is in a maintainable fashion
  • 4. SPOD ? SPOD is well known as ¡°Single Point of definition¡± ? SPOD simply implies that define once and use every where!!!! ? Therefore, developer does not need to repeat the code.
  • 5. Explicit Vs Implicit ? Use Explicit cursors as much as possible in code. ? Avoid to use ¡®select¡¯ implicit cursor ? Nevertheless, Steven Feuerstein has recommended to use implicit cursor in the code. ? BUT in IFS context, ¡®Explicit¡¯ cursors are recommended!!!
  • 6. Avoid!! ? Avoid Hard coding ? Avoid to use VARCHAR2(N) declaration ? Avoid to use ¡®Literal¡¯ value. But, use name%type or name%rowtype
  • 8. Data encapsulation ? Hide business rules and formulas! ? Move blocks of complex code such as Function and Procedure ? Write small, Narrowly focused code easy to reuse package
  • 10. Error Handling ? Handles the errors separately and have package for that