Generic collection types in PLSQL

  • 1,792 views
Uploaded on

How to introduce common generic collection types like lists, maps, sets, trees, graphs in PLSQL

How to introduce common generic collection types like lists, maps, sets, trees, graphs in PLSQL

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
1,792
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
19
Comments
0
Likes
0

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. Generic Collection Types v1.0How to enrich the programmers PLSQL toolkitArnold Reuser
  • 2. Agenda 1 Serving a need 2 What Generic Collection Types can do for you 3 How you can make a differencePage  2 Generic Collection Types v1.0
  • 3. Serving a needMissing feature of PLSQL PLSQL provides the collection types table and varray - Collection types that allow you to declare index-by tables, nested tables and variable-size arrays. - Collection types that reflect a table like structure. PLSQL does not provide generic collection types - Collection types as lists, maps, sets, trees, graphs, … - Collection types with a specialized purpose and their own unique strengths and weaknessesPage  3 Generic Collection Types v1.0
  • 4. Serving a needMissing feature of PLSQL PLSQL types however can be used as building blocks Building blocks to create generic collection types Collection types as lists, maps, sets, trees, graphs, …. Collection types that will enrich the PLSQL programmers toolkitPage  4 Generic Collection Types v1.0
  • 5. Serving a needMissing feature of PLSQL A rich PLSQL programmers toolkit will help shift the focus Shift the focus from purely technical problems to business problems Which will help the business generate more valuePage  5 Generic Collection Types v1.0
  • 6. What Generic Collection Types can do for you Current status Practical applicationsPage  6 Generic Collection Types v1.0
  • 7. Current Status Collection Type Description Collection collection of elements List ordered collection of elements, permitting duplicates Set collection of elements, forbids duplicates within the collection. Map key to value pairs, without duplicate keys Tree hierarchical collection of elements Graph interconnected collection of elementsPage  7 Generic Collection Types v1.0
  • 8. Current StatusUtility packages are introduced to extend the functionality of the available types.Read the user guide for all the details on the utility packages. Collection Type Available Type Collection Collection List List Set Map SimpleMap,SimpleHashMap,BaseMap Tree Graph GraphPage  8 Generic Collection Types v1.0
  • 9. Practical ApplicationsList is ordered collection of elements, permitting duplicatesSupported types are lists of strings, numbers, dates, … Sneak preview of usage list StringList := new StringList(FAX,WORK,HOME); putil.extend(list,MOBILE); contains boolean := putil.contains(list,MOBILE); idx integer := putil.indexOf(list,MOBILE); list := putil.exclude(list,MOBILE);List is implemented as a nested table.multiset operations are therefore available for usagePage  9 Generic Collection Types v1.0
  • 10. Practical ApplicationsSimpleMap is collection of key to value pairs, without duplicate keys.Focus is on simplicity; both key and value are of type string Sneak preview of usage map StringList := StringList(); mapUtil.setString(map,AMOUNT_TYPE,TOTAL_PARTS); mapUtil.setString(map,AMOUNT_UNIT,CURRENCY); mapUtil.setString(map,AMOUNT_VALUE,1469); mapKeys varchars_t := mapUtil.keySet(map); amountType varchar2(100) := mapUtil.getString(map,AMOUNT_TYPE);Page  10 Generic Collection Types v1.0
  • 11. Practical ApplicationsSimpleHashMap is collection of key to value pairs, without duplicate keys.Focus is on performance; both key and value are of type string Sneak preview of usage map StringMatrix := mapUtil.createHashMap(pp_nrOfBuckets => 10); mapUtil.setString(map,AMOUNT_TYPE,TOTAL_PARTS); mapUtil.setString(map,AMOUNT_UNIT,CURRENCY); mapUtil.setString(map,AMOUNT_VALUE,1469); mapKeys varchars_t := mapUtil.keySet(map); amountType varchar2(100) := mapUtil.getString(map,AMOUNT_TYPE);Page  11 Generic Collection Types v1.0
  • 12. Practical ApplicationsBaseMap is collection of key to value pairs, without duplicate keys.Focus is on extensive support for different key and value types Sneak preview of usage map BaseMap := mapUtil.createBaseMap(); mapUtil.setNumber(map,CMCD_ID,1051); mapUtil.setString(map,CMCD_COMMUNICATION_CODE,arnold@reuser.info); mapUtil.setDate(map,CMCD_VALID_FROM,sysdate); mapUtil.setString(map,CMCT_DESCR,home_email); mapUtil.setBoolean(map,CMCT_IND_ACTIVE,true); mapKeys StringList := mapUtil.keySet(map); cmctDescr varchar2(100) := mapUtil.getString(map,CMCT_DESCR);Note there are other types BaseMap can support.Read the user guide for more detail on this.Page  12 Generic Collection Types v1.0
  • 13. Practical ApplicationsGraph is an interconnected collection of elements. Graphs can be used to represent a dynamic hierarchical structure e.g. XML Graphs can be used to define other generic types e.g. BaseMap Graphs are used if no other data structure delivers a proper solution Graphs provide extensive support for different value types Graphs have their roots in discrete mathematics.How the elements of a Graph are connected is up to you.If you really need a Graph. Read the user guide and code thoroughly.Page  13 Generic Collection Types v1.0
  • 14. 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  14 Generic Collection Types v1.0
  • 15. Do You Have Any Questions? We would be happy to help.Page  15 Generic Collection Types v1.0