Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Escaping special characters from SQL statements

Status
Not open for further replies.

smitakale

Programmer
Jun 17, 2002
6
0
0
IN
Hi,

I am facing the problem of escaping single and double quotes in stored procedure am writing for creating teradata user.

eg. consider the following statements -

1. SET createUserSQL = 'CREATE USER ' || '"' || erUserName || '"';
In this statement if variable erUserName contains double qoutes, it should be escaped using double quotes first, otherwise SQL statement 'CREATE USER' will give error.

2. SET createUserSQL = createUserSQL || ',' || ' STARTUP = ' || '''' || erStartupString || '''';
In this statement if variable erStartupString contains single qoutes, it should be escaped using single quotes.

I have to do this for most of the attributes in 'Create User' call.

So the question here is, how to find and replace occurances of specific substring from the given string. Is there any string function available for that ?
Or is there function for escaping special characters in string ?

Thanks,
Smita.










 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top