8 thoughts on “predefined collections

  1. Gary

    I’ve used the following, which is also available in 9iR2:
    select * from table(sys.dbms_debug_vc2coll(‘A’,'B’,'C’));
    This one is a TABLE OF VARCHAR2(1000), where ODCIVarchar2List is a VARRAY(32767) OF VARCHAR2(4000), so yours does give more space.

  2. DJ

    Come on, it takes a single SQL to create your own defined types. Why rely on system types that may change in the next release? One less thing to check for upgrade.

  3. Laurent Schneider Post author

    DJ,
    Why should a SQL statement depend on a type, when there is a documented datatype which is not supposed to change in next release (because it is documented). Oracle cannot remove features in a next release without notice. I would say it is OK to rely on them because *they are documented*

    Those extensibility types also exist for date, numbers and raw.

    Gary,
    How could you say my one use more space? 32767 is a limit. Also varchar2(1000) is a meaningless constraint on varchar2, 4000 is the maximum. Could you show the difference in memory usage?

    But true, those extensibility types are documented only in 10gR2 and 11gR1. So in 9iR2, dbms_debug_vc2coll sounds possible

  4. Laurent Schneider Post author

    I made a test Garry and it seems you are right about memory usage.

    
    select * from table(sys.ODCIVarchar2List('AAA','BBB','CCC'))
    
    COLUMN_VALUE                                                                    
    ------------
    AAA                                                                             
    BBB                                                                             
    CCC                                                                             
    
    select * from table(sys.dbms_debug_vc2coll('AAA','BBB','CCC'))
    
    COLUMN_VALUE                                                                    
    ------------
    AAA                                                                             
    BBB                                                                             
    CCC                                                                             
    
    select sql_text,sharable_mem,persistent_mem,runtime_mem 
    from v$sqlarea 
    where sql_text like '%AAA%' 
    and sql_text not like '%sharable%'
    
    SQL_TEXT                                                                        
    --------
    SHARABLE_MEM PERSISTENT_MEM RUNTIME_MEM
    ------------ -------------- -----------
    select * from table(sys.ODCIVarchar2List('AAA','BBB','CCC'))                    
           13582          13752       12864
                                                                                    
    select * from table(sys.dbms_debug_vc2coll('AAA','BBB','CCC'))                  
           13584           4752        3864
                                                                                    
    

  5. Chris

    What imho really sucks is that oracle is not capable of producing a set of reusable components for pl/sql development. E.g., there should be a goddamn standard table of varchar2(4000) that everybody uses! Well, they’d better get a better name ;-)

Leave a Reply

Your email address will not be published.


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>