Oracle9i Application Developer's Guide - Large Objects (LOBs)
Release 1 (9.0.1)

Part Number A88879-01
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

Feedback

Go to previous page Go to beginning of chapter Go to next page

Migrating From LONGs to LOBs, 8 of 14


Applications Requiring Changes When Converting From LONGs to LOBs

Even with implicit conversions to LOBs, some changes will have to be made to your application. Cases where you will have to make changes to your application, are listed in the following paragraphs.

Overloading with Anchored Types

For applications using anchored types, some overloadings would silently resolve to different targets during the conversion to LOBs. For example:

procedure p(l long) is ...;       -- (1)  
procedure p(c clob) is ...;       -- (2)  

Consider the caller:

declare  
     var  longtab.longcol%type;  
   begin  
     ...  
   p(var);  
     ...  
end;  

Prior to LOB migration this call would have resolved to overload (1). Once longtab is migrated to LOBs this call will silently resolve to overload (2). A similar issue arises if the parameter to (1) was CHAR, VARCHAR2, RAW, LONG RAW.

When migrating LONG columns to LOB you have to manually examine and fix dependent applications.

Because of the new conversions, some existing applications with procedure overloadings, that include LOB arguments, may still break. This includes applications that DO NOT use LONG anchored types. For example,

procedure p(n number) is ...;       -- (1)  
procedure p(c clob) is ...;         -- (2)  
  
p('abc');  

Previously, the only conversion allowed was CHAR to NUMBER, so (1) would be chosen. Now, both conversions are allowed, so the call is ambiguous and raises an overloading error.

Implicit Conversion of NUMBER, DATE, ROW_ID, BINARY_INTEGER, and PLS_INTEGER to LOB is Not Supported

PL/SQL currently permits conversion of NUMBER, DATE, ROW_ID, BINARY_INTEGER, and PLS_INTEGER to LONG. There are no plans to support implicit conversions from these types to LOB (explicit or implicit). Users relying on these conversions will have to explicitly convert these types TO_CHAR. Hence, if you had an assignment of the form:

number_var := long_var;  -- The RHS becomes a LOB variable after conversion

Then you have to explicitly modify your code to say:

number_var := TO_CHAR(long_var); -- Note that long_var is of type CLOB after 
conversion

No Implicit Conversions of BLOB to VARCHAR2, CHAR, or CLOB to RAW or LONG RAW

Also, there is no implicit conversion from the following:

Hence if you had the following code:

SELECT <long raw column> INTO <varchar2> VARIABLE FROM <table>


and you changed the LONG RAW column into BLOB, this SELECT statement will not work. You have to add the TO_RAW or a TO_CHAR conversion operator on the selected variable such as:

SELECT TO_RAW(<long raw column>) INTO <varchar2> VARIABLE FROM <table>  
-- note that the long raw column is now a BLOB column


The same holds for selecting a CLOB into a RAW variable, or for assignments of CLOB to RAW and BLOB to VARCHAR2.


Go to previous page Go to beginning of chapter Go to next page
Oracle
Copyright © 1996-2001, Oracle Corporation.

All Rights Reserved.
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

Feedback