If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Oracle > Prepend data for CLOB

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-17-12, 09:51
arunshankar.c arunshankar.c is offline
Registered User
 
Join Date: Sep 2010
Posts: 2
Prepend data for CLOB

Hello,

Could you please help me on the below case. To append a string, below code can be used, for eg : v_str in the below case i.e the current entry for v_str is appended for the previously stored string value.

Code:
v_str := v_str ||'Total Records = 0 Processed = 0' || CHR(13) || CHR(10);
SELECT data_value INTO g_clob FROM ni_sim_order_artifact WHERE artifact_type = 60002 AND sim_order_fk = p_sim_order_pk FOR UPDATE;
DBMS_LOB.WRITEAPPEND(g_clob, length(v_str), v_str);
INSERT INTO NI_SIM_ORDER_HST values(ni_sim_order_hst_seq.nextval, p_sim_order_pk, GMTSYSDATE, p_user_id, 60003,'Moved to state Rejected, refer validation logs.');
UPDATE NI_SIM_ORDER SET STATUS=60003 WHERE ORDER_NUMBER=p_batch_number;
COMMIT;
Could you please suggest a way in which I can prepend v_str value every time instead of appending.

For example :

Lets assume 1 was inserted, now in above statements if i want to insert 2 to ni_sim_order_artifact table then in current setup 1 is inserted and then 2. Please let me know a way to insert 1 initially and then 2 needs to be prepended to 1.

Thank you
Arun

Last edited by arunshankar.c; 01-17-12 at 10:01.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On