My Oracle Support Banner

How to Set Search Expr to Query String with Quote(') in escript? (Doc ID 543203.1)

Last updated on SEPTEMBER 21, 2017

Applies to:

Siebel Tools - Version 7.7.2.1 SIA [18353] and later
z*OBSOLETE: Microsoft Windows 2000

Goal

User needs to query contact BC using eScript with search criteria as:
Last Name: O'Neal
First Name: Robert
Work Phone #: 3154323300
The character quote (') in last name is causing the problem in query.

The search expression is set as :

strsrchExpr = "[Last Name] = '" +val2.replace(/[']/g, "''")+ "' AND [First Name]= '" +val1.replace(/[']/g, "''")+ "' AND [Work Phone #]= '" +val3+ "'";


[User has already defined val1=Robert,val2=O'Neal,val3=3154323300]
The string 'strsrchExpr is formed as below:

[Last Name]= 'O''Neal' AND [First Name]= 'Robert' AND [Work Phone #]= '3154323300'


Though this does not give any syntax error, this does not return the record in query.

Then the following was we tried:

var strsrchExpr = "[Last Name] = '" +"\""+val2.replace(/[']/g, "''")+"\""+ "' AND [First Name]= '" +val1.replace(/[']/g, "''")+ "' AND [Work Phone #]= '" +val12+ "'";


This again doesn't give syntax error but string formed as below does not return the record either.

[Last Name] = '"O''neal"' AND [First Name]= 'Robert' AND [Work Phone #]= '3154323300'


How can the search expr be set to to query string with quote(') in it, in eScript?

Solution

To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!


In this Document
Goal
Solution

My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.