Your SlideShare is downloading. ×
0
Plsql commons
Plsql commons
Plsql commons
Plsql commons
Plsql commons
Plsql commons
Plsql commons
Plsql commons
Plsql commons
Plsql commons
Plsql commons
Plsql commons
Plsql commons
Plsql commons
Plsql commons
Plsql commons
Plsql commons
Plsql commons
Plsql commons
Plsql commons
Plsql commons
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Plsql commons

1,801

Published on

Reusable plsql components to solve common technical problems.

Reusable plsql components to solve common technical problems.

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,801
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
48
Comments
0
Likes
1
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. PLSQL Commons v1.0How to enrich the programmers PLSQL toolkitArnold Reuser
  • 2. Agenda 1 Serving a need 2 What PLSQL Commons can do for you 3 How you can make a differencePage  2 PLSQL Commons v1.0
  • 3. Serving a needReusable PLSQL Components PLSQL Commons is a project focused on creating and maintaining reusable PLSQL components. Components that will enrich the PLSQL programmers toolkit Components that promote the programmers shift from solving purely technical problems to actual business problemsPage  3 PLSQL Commons v1.0
  • 4. Serving a needReusable PLSQL Components PLSQL Commons is used by a CRM service provider of General Motors to handle their specific needs Used on their production Oracle database servers as the defacto standard components for the past three yearsPage  4 PLSQL Commons v1.0
  • 5. What PLSQL Commons can do for you Current status Practical applicationsPage  5 PLSQL Commons v1.0
  • 6. Current StatusThere are several upcoming sandbox components not mentioned.This presentation will focus on just a few components. Component Focus plsql_async Parallel processing of tasks plsql_cache General purpose memory based caching plsql_error Exception management plsql_file Reading and writing operating system text files plsql_ftp Copy a file from one host to another based on the ftp protocol. plsql_host Executing a command in the host environment plsql_log Logging application behavior plsql_match Text search engine plsql_test Writing repeatable unit tests plsql_timeit Measuring the execution time of a program unit plsql_util General purpose utilities plsql_soap Lightweight webservices based on the soap protocolPage  6 PLSQL Commons v1.0
  • 7. Practical ApplicationsParallel processing of tasks Imagine a potential pipeline of an ETL process to load CRM data. The pipeline passes several processing elements.Page  7 PLSQL Commons v1.0
  • 8. Practical ApplicationsParallel processing of tasks If the elements Address and Communication are independent. The pipeline could be organized to process these elements in parallelPage  8 PLSQL Commons v1.0
  • 9. Practical ApplicationsParallel processing of tasks Fundamental questions : • How can you maintain the processing flow? • What if Address and Communication would like to pass their identifiers?Page  9 PLSQL Commons v1.0
  • 10. Practical ApplicationsParallel processing of tasks The answers provided : - plsql_async can be used to route and maintain the processing flow - plsql_async can be used to pass information between sequential processes - plsql_cache can be used to cache session and cross-session based information Read the user guide for more details on this. If your interest in building a processing flow. Read the book Enterprise Integration Patterns.Page  10 PLSQL Commons v1.0
  • 11. Practical ApplicationsException management Assertion at any location you assume will not be reached. gender char(1) := A; plsql_test.assert(gender in (M,F),Gender can be M or F; current value is {1},varchars_t(gender)); Error to identify an exceptional condition that an application might want to catch soapFaultReason varchar2(100) := ImportDataRecord has been invoked at an illegal or inappropriate time.; err.raise(err.SOAPFaultException,operation raised exception : {1},varchars_t(soapFaultReason));Page  11 PLSQL Commons v1.0
  • 12. Practical ApplicationsTesting application behavior plsql_test is a testing facility for the plsql programming plsql_test will help you : - measure your progress, spot unintended side effects, and focus your development efforts - without automated testing tools like this facility retesting can be a tedious and inaccurate process. - by allowing the testing process to occur frequently and automatically, you can keep software coding errors at a minimumPage  12 PLSQL Commons v1.0
  • 13. Practical ApplicationsTesting application behavior Developing a test suite create package body test_plsql_util_pck as procedure t_varchars is vt1 varchars_t:= new varchars_t(A,B); begin plsql_test.assert(vt1.count = 2,list contains only two elements); end; procedure t_isWhiteSpace is cause varchar2(2000) := incorrect implementation of contract; begin plsql_test.assert(putil.isWhiteSpace( ),cause); -- a space is whitespace plsql_test.assert(not putil.isWhiteSpace(null),cause); -- null is not whitespace plsql_test.assert(not putil.isWhiteSpace(),cause); -- empty string is not whitespace end; end;  Each and every package can become a test suite. - Just add a few procedures with prefix t_ to turn it into a test suite. - Once thats done. It can be run as a test suite.Page  13 PLSQL Commons v1.0
  • 14. Practical ApplicationsTesting application behavior Running a test suite DBMS Output ===== Run Test Suite ==== plsql_test.runTestSuite unit TST_PLSQL_UTIL_PCK.T_ISWHITESPACE succeeded ( module => test_plsql_util_pck unit TST_PLSQL_UTIL_PCK.T_VARCHARS succeeded , runAll => true ===== Test Report ===== ); Run 2 tests of which 2 succeeded and 0 failedPage  14 PLSQL Commons v1.0
  • 15. Practical ApplicationsLogging application behavior Sneak Preview DBMS Output 20110113-10:47:45.228 INFO gender is M plog.turn_on; gender char(1) := M; plog.info(gender is {1},varchars_t(gender));  Logging supports - Different layout types : text, rich_text, custom - Different output types : dbms_pipe, dbms_output, http, table - Different levels of logging : trace, debug, info, info, warn, error, fatal  Read the userguide for more details on this.Page  15 PLSQL Commons v1.0
  • 16. Practical ApplicationsMeasuring application behavior Sneak Preview number idx; plsql_timeit.remove; plsql_timeit.start_watch(pp_context => assignment); idx := 1; plsql_timeit.stop_watch(pp_context => assignment); plog.info(took {1} millisec,varchars_t(mmit_plsql_timeit_pck.period(pp_context => assignment,pp_total => true));  plsql_timeit is a facility to measure the execution time of a program unit - measure if the execution time of your code is fit for use  plsql_timeit and plsql_test could be combined to introduce load, volume, overload and stress test functionality.Page  16 PLSQL Commons v1.0
  • 17. Practical ApplicationsGeneral purpose utilities Sneak Preview var varchar2(200) := chr(10); -- new line isWhiteSpace boolean := putil.isWhiteSpace(var); plog.info(putil.toChar(isWhiteSpace));  The standard libraries fail to provide enough general purpose methods.  plsql_util provides these methodsPage  17 PLSQL Commons v1.0
  • 18. Practical ApplicationsGeneral purpose utilities Sneak Preview list StringList := new StringList(el2,el1); list := putil.sort(list); val varchar2(32767) := putil.join(list,#); list := putil.split(val,#);  The standard libraries fail to provide enough general purpose methods.  plsql_util provides these methodsPage  18 PLSQL Commons v1.0
  • 19. Practical ApplicationsGeneral purpose utilities Sneak Preview list StringList := new StringList(el2,el1); list := putil.sort(list); val varchar2(32767) := putil.join(list,#); list := putil.split(val,#);  The standard libraries fail to provide enough general purpose methods.  plsql_util provides these methodsPage  19 PLSQL Commons v1.0
  • 20. How you can make a difference Give it a try Be a happy user Tell us and the whole wide world about it! If you would like to get in touch. Drop me a mail at arnold@reuser.infoPage  20 PLSQL Commons v1.0
  • 21. Do You Have Any Questions? We would be happy to help.Page  21 PLSQL Commons v1.0

×