全部博文(136)
分类: Oracle
2008-06-07 10:19:12
DECLARE directions CLOB; BEGIN SELECT UPPER(falls_directions) INTO directions FROM waterfalls WHERE falls_name = 'Munising Falls'; END; |
DECLARE directions CLOB; BEGIN SELECT falls_directions INTO directions FROM waterfalls WHERE falls_name = 'Munising Falls'; END; |
SELECT falls_name FROM waterfalls WHERE INSTR(UPPER(falls_directions),'MACKINAC BRIDGE') <> 0; |
Oracle Text and SQL SemanticsIf you need to execute queries that look at uppercase versions of CLOB values, and you need to do so efficiently, Oracle Text may hold the solution. For example, you might reasonably expect to write a query such as the following some day: SELECT falls_name If falls_directions is a CLOB column, this query may not be all that efficient. However, if you are using Oracle Text, you can define a case-insensitive Oracle Text index on that CLOB column, and then use the CONTAINS predicate to efficiently evaluate the query: SELECT falls_name For more information on CONTAINS and case-insensitive indexes using Oracle Text, see Oracle's Text Application Developer's Guide. |
Function |
Description |
---|---|
TO_CLOB (character_data) |
Converts character data into a CLOB. The input to TO_CLOB can be any of the following character types: VARCHAR2, NVARCHAR2, CHAR, NCHAR, CLOB, and NCLOB. If necessary (for example, if the input is NVARCHAR2), input data is converted from the national character set into the database character set. |
TO_BLOB(raw_data) |
Similar to TO_CLOB, but converts RAW or LONG RAW data into a BLOB. |
TO_NCLOB (character_data) |
Does the same as TO_CLOB, except that the result is an NCLOB using the national character set. |
TO_LOB (long_data) |
Accepts either LONG or LONG RAW data as input, and converts that data to a CLOB or a BLOB, respectively. TO_LOB may be invoked only from the select list of a subquery in an INSERT ... SELECT ... FROM statement. |
TO_RAW |
Takes a BLOB as input and returns the BLOB's data as a RAW value. |
The TO_LOB function is designed specifically to enable one-time conversion of LONG and LONG RAW columns into CLOB and BLOB columns, because LONG and LONG RAW are now considered obsolete. The TO_CLOB and TO_NCLOB functions provide a convenient mechanism for converting character large object data between the database and national language character sets.