Oracle9i Application Developer's Guide - Large Objects (LOBs) Release 1 (9.0.1) Part Number A88879-01 |
|
Migrating From LONGs to LOBs, 8 of 14
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.
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.
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
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.
|
Copyright © 1996-2001, Oracle Corporation. All Rights Reserved. |
|