Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Having problem escaping quotes

Re: Having problem escaping quotes

From: Darren Brock <brock_at_governet.net>
Date: Tue, 12 Oct 1999 08:45:32 -0600
Message-ID: <3803498C.BC7F589C@governet.net>


I would try changing the delimiter from quotes to something else that you know is not used in the data. You should then replace all the single quotes with single quote single quote (''). This will allow the insertion of single quotes.

Darren

"Brad E. Wagner" wrote:
>
> I have a client server application that is passing information to an
> external database (not one of ours).
>
> The script getting called looks like:
>
> #! /usr/bin/ksh
>
> # declare positional parameters
>
> last=$1
> first=$2
> vnet=$3
> phone=$4
> priority=$5
> problem_type=$6
> short_description=$7
> status=$8
> remedy_id=$9
> resolve_date=${10}
> problem_details=${11}
> tivoli_id=${12}
> error_flag=0
> current_date=${13}
>
> {
> echo "last = $last"
> echo "first = $first"
> echo "vnet = $vnet"
> echo "phone = $phone"
> echo "priority = $priority"
> echo "problem_type = $problem_type"
> echo "short_description = $short_description"
> echo "status = $status"
> echo "remedy_id = $remedy_id"
> echo "resolve_date = $resolve_date"
> echo "problem_details = $problem_details"
> echo "tivoli_id = $tivoli_id"
> echo "current_date = $current_date"
>
> # log on to Oracle with a block of code
> echo "sending ticket $remedy_id to Tivoli. Results ="
> /path/sqlplus user/password_at_HOST << EOF
>
> insert into REMEDY_TRANSACTION
> (LAST_NAME,FIRST_NAME,VNET,PHONE_NUMBER,PRIORITY,PROBLEM_TYPE,SHORT_DESCRIPTION,STATUS,REMEDY_ID,RESOLVED_DATE,PROBLEM_DETAILS,TIVOLI_ID,ERROR_FLAG,MODIFY_DATETIME)
> VALUES
> ('$last','$first','$vnet','$phone','$priority','$problem_type','$short_description','$status','$remedy_id','$resolve_date','$problem_details','$tivoli_id','$error_flag','$current_date');
> list;
> commit;
> disc
> exit
> EOF
> } >> /tmp/tivoli.log
>
>
>
> the app is calling the external program with sample data like:
>
> /path/remedy_tivoli "last" "first" "vnet" "phone,num" "priority"
> "problem type" "short description" "status" "keyid" "resolve date"
> "the word "double" is enclosed in double quotes and 'single' is
> enclosed in single
> quotes and this line wraps.
> this line is on a new line.
> " "tv04" "1"
>
> or
>
> /path/remedy_tivoli "last" "first" "vnet" "phone,num" "priority"
> "problem type" "short description" "status" "keyid" "resolve date"
> "Thursday, October 07, 1999 12:35:59PM emetzger
> Thursday, October 07, 1999 02:35:53AM emetzger
> Receiving "recieve reply" errors when trying to use RMS. Reference
> previous PMR, blah, blah, blah...."this part is in double quotes" and
> 'this part is in single quotes'... oh, I don't know" "destid" "1"
>
> What is killing me is the problem details field ($11). If it contains
> a quote (single, double, matched or unmatched), it reaches beyond what
> I am scripted to handle.
>
> Can anyone suggest a way to trap and escape those extra (or nested)
> quotes for that field? Since it is having the issue with them even as
> it is parsing the command line, I am not able to trap for it as I
> would like (so far :-) )
>
> I appreciate any knowledge you can share.


Received on Tue Oct 12 1999 - 09:45:32 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US