Click here to Skip to main content
Licence CPOL
First Posted 16 Jul 2010
Views 3,251
Bookmarked 0 times

Migrating OpenInsight(Multivalue) Database to Oracle(ORDBMS) -4

In previous post we saw techniques to create collections on the fly to simulate the multi-value columns in Oracle. In this part we use simple PL/SQL function to aggregate individual collection values in to single field separated by value Delimiter. Following function creates multi-valued string from
A Technical Blog article. View original blog here.[^]

In previous post we saw techniques to create collections on the fly to simulate the multi-value columns in Oracle. In this part we use simple PL/SQL function to aggregate individual collection values in to single field separated by value Delimiter.

Following function creates multi-valued string from the Oracle collection More info

FUNCTION To_String (      
  Nt_in        IN Varchar2Table, 
  Delimiter_in IN VARCHAR2 DEFAULT ‘,’ 
  ) RETURN VARCHAR2  
IS 
     v_idx PLS_INTEGER; 
     v_str VARCHAR2(4000 BYTE); 
     v_dlm VARCHAR2(10); 
  BEGIN 
     v_idx := nt_in.FIRST; 
     WHILE v_idx IS NOT NULL LOOP 
        v_str := v_str || v_dlm || nt_in(v_idx); 
        v_dlm := delimiter_in; 
        v_idx := nt_in.NEXT(v_idx); 
     END LOOP; 
     RETURN v_str; 
  END To_String; 

The above function helps developer to pass values to Business layer while migrating multi-value column to Oracle.

 

The following Query will first aggregate the rows in to collection table and convert to the multi-value column

SELECT migration.to_string( CAST( COLLECT( NAME ) AS Varchar2Table ) ) FROM EMPLOYEEADDRESS 

Result

image 

 

Migrating Sub-Values to Oracle

Oracle supports ORDBMS concepts from version 8i which allows users to create user defined types and include them as column datatypes(Complex type in SQL developer).

Prior to Oracle 9i, collections could only be used to represent a single dimension of information (a list of names or salaries). With Oracle 9i and support for multi-level collections, PL/SQL developers can now model multi-dimensional phenomena. More info

In addition to sub-value enhancements, Oracle 10, 11 versions provides more advanced ORDBMS features.

[to be continued in ORDBMS series of Oracle]

Related posts:

  1. Migrating OpenInsight(Multivalue) Database to Oracle(ORDBMS) -3 Oracle ORDBMS support for multivalue columns (Version 8 onwards) Version...
  2. Migrating OpenInsight(Multivalue) Database to Oracle(RDBMS) -1 What’s OpenInsight ? OpenInsight is a repository-based applications development environment...
  3. Migrating OpenInsight(Multivalue) Database to Oracle(RDBMS) -2 Why do we need to Migrate ? Multivalue databases have...

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Sabarinathan Arthanari

Other
Mahindra Satyam
India India

Member

Follow on Twitter Follow on Twitter
I have been programming for last 10 years on various platforms including .NET, Visual Basic 6, Oracle and SQL server.
 
I decided to write articles when I have free time hoping to share my thoughts with you.
 
To know more about me visit http://sabarinathanarthanari.com

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralFlexible datatype PinmemberAjay Kale New1:30 11 Nov '10  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web01 | 2.5.120209.1 | Last Updated 16 Jul 2010
Article Copyright 2010 by Sabarinathan Arthanari
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid