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.
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.