Solved

Appending VARCHAR to CLOB

Posted on 1999-01-29
4
3,499 Views
Last Modified: 2011-09-20
I'm writing a trigger which will, when a row is INSERTed, populate a field with a concatenation of four of the inserted fields.  Some fields are CLOBs and some are VARCHARs.  Appending CLOBs to each other is easy - DBMS_LOB.APPEND(), as is appending VARCHARs to each other - using ||.  But how do I append a VARCHAR to a CLOB?

DBMS_LOB.APPEND() throws all its toys on the floor and I can't find a suitable conversion function.
0
Comment
Question by:NukeEmUp
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 

Author Comment

by:NukeEmUp
ID: 1083900
Points increased to 75 as no answer in 24hrs.
0
 

Author Comment

by:NukeEmUp
ID: 1083901
Points increased to 200 cos this is getting urgent ;-)
0
 
LVL 6

Accepted Solution

by:
zebada earned 200 total points
ID: 1083902
If it is urgent then this answer may be a little late......
but anyway try this:
SQL> desc x
 Name                            Null?    Type
 ------------------------------- -------- ----
 KEY                                      VARCHAR2(8)
 DATA                                     CLOB

SQL> select * from x;

KEY      DATA
-------- -----------------------------------------------------------------------
---------
One      First

SQL> select dbms_lob.substr(data,dbms_lob.getlength(data)) || key from x;

DBMS_LOB.SUBSTR(DATA,DBMS_LOB.GETLENGTH(DATA))||KEY
--------------------------------------------------------------------------------
--------------------
FirstOne
0
 

Author Comment

by:NukeEmUp
ID: 1083903
You're right - it was too late.  To get the code finished on time I didn't bother with a trigger, just did the concatenation in perl before bunging the data into Oracle.  But now I know how it _should_ be done so I'll give you the points anyway ;-)
0

Featured Post

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Sybase and replication server 13 82
Oracle 12c Default Isolation Level 17 64
Oracle Date 6 41
ORACLE SQL DEVELOPER + Compare Tables 5 37
Working with Network Access Control Lists in Oracle 11g (part 2) Part 1: http://www.e-e.com/A_8429.html Previously, I introduced the basics of network ACL's including how to create, delete and modify entries to allow and deny access.  For many…
How to Create User-Defined Aggregates in Oracle Before we begin creating these things, what are user-defined aggregates?  They are a feature introduced in Oracle 9i that allows a developer to create his or her own functions like "SUM", "AVG", and…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question