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 > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > How to insert String into CLOB field

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 09-20-09, 23:14
orpu orpu is offline
Registered User
 
Join Date: Sep 2009
Posts: 2
How to insert String into CLOB field

Hi,

I have a long .log file sitting in the unix file server.
I convert the file into the string and insert into the clob filed in oracle database.

but i am getting the following error.

ERROR:
ORA-01756: quoted string not properly terminated


SP2-0734: unknown command beginning "+ ReturnSt..." - rest of line ignored.
SP2-0734: unknown command beginning "+ [ 0 -ne ..." - rest of line ignored.
SP2-0734: unknown command beginning "+ myJobRun..." - rest of line ignored.
SP2-0734: unknown command beginning "+ br_Updat..." - rest of line ignored.
SP2-0044: For a list of known commands enter HELP
and to leave enter EXIT.
SP2-0552: Bind variable "PLS" not declared.
SP2-0734: unknown command beginning "PL/SQL pro..." - rest of line ignored.
SP2-0734: unknown command beginning "+ ReturnSt..." - rest of line ignored.
SP2-0734: unknown command beginning "+ [ 0 -ne ..." - rest of line ignored.
SP2-0734: unknown command beginning "+ myJobRun..." - rest of line ignored.
SP2-0044: For a list of known commands enter HELP
and to leave enter EXIT.
SP2-0734: unknown command beginning "+ br_Updat..." - rest of line ignored.
ERROR:
ORA-01756: quoted string not properly terminated

My Code

br_Update_Proxy_Job_Run_Status()
{
typeset -i myArgCount=$#

if [ $myArgCount -lt 2 ]
then
br_PrintMessage W \
"NOT Enough aruments for the function br_Update_Proxy_Job_Run_Status? $Bell"
return $BR_WARNING_STATUS
fi

typeset myFile=""
typeset myJobRunStatusMsg="$1"
typeset -i myRunStatusId="$2"
typeset -i myRptTotalInsertedETL="$3"
typeset -i myRptTotalUpdatedETL="$4"
typeset -i myRptTotalErrorETL="$5"
typeset myLogFile="$8"

if [ -z "$8" ]
then
myFile=""
else
myFile=`cat $myLogFile | sed "s/\'/''/g"`
fi



echo "file :: $myFile"


sqlplus -s $DBCredentials <<-EndOFSQL

SET DEFINE OFF;
SET SERVEROUT ON

DECLARE
i_run_status_id VARCHAR2(100) := $myRunStatusId;
i_end_time VARCHAR2(1000);
i_total_errors NUMBER := $myRptTotalErrorETL;
i_total_warnings VARCHAR2(1000);
i_total_inserted NUMBER := $myRptTotalInsertedETL;
i_total_updated NUMBER := $myRptTotalUpdatedETL;
i_total_rejected NUMBER := 0 ;
i_log_file CLOB := TO_CLOB('$myFile');
i_job_run_message VARCHAR2(512) := '$myJobRunStatusMsg';
i_modlast_by VARCHAR2(1000);
o_sqlcode NUMBER := 0 ;
o_sqlmsg VARCHAR2(1000);
BEGIN
$USP_UPD_JOB_RUN_STATUS
(
i_run_status_id,
i_end_time,
i_total_errors,
i_total_warnings,
i_total_inserted,
i_total_updated,
i_total_rejected,
i_log_file,
i_job_run_message,
i_modlast_by,
o_sqlcode,
o_sqlmsg
);


END;
/
EndOFSQL

}

Please help it very urgent
Reply With Quote
  #2 (permalink)  
Old 09-21-09, 10:21
kitaman kitaman is online now
Registered User
 
Join Date: Sep 2009
Location: Ontario
Posts: 528
Does the string need to have a null terminator?
You could add a null to the end of the file using: echo "\000\c" >>file
Reply With Quote
  #3 (permalink)  
Old 09-22-09, 09:35
n_i n_i is online now
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,233
The string does not need to have a null terminator, but all single quotes in it must be escaped.
Reply With Quote
  #4 (permalink)  
Old 09-22-09, 12:45
kitaman kitaman is online now
Registered User
 
Join Date: Sep 2009
Location: Ontario
Posts: 528
myFile=`cat $myLogFile | sed "s/\'/''/g"`
This line should read:
myFile=`cat $myLogFile | sed "s/\'/\''/g"`
Reply With Quote
  #5 (permalink)  
Old 09-27-09, 03:05
affek affek is offline
SPAMMER
 
Join Date: Sep 2009
Posts: 4
i can't do anything..sorry
Reply With Quote
Reply

Thread Tools
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