Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
fdj1975
Starting Member
2 Posts |
Posted - 2012-06-20 : 10:54:43
|
| I am trying to figure out how to get my script to email by looking at two characters instead of one. This is what I have now using one character:my $sql = qq{ select Connection_symbol, Name_0, decode(substr(name_0, 1,1), 'K', 'Line1', '3', 'Line2', 'P', 'Line3', '5', 'Line4', 'No Pattern') from p_connections where error_text like 'SYS disconnected' and connection_symbol like '%SYS'};The reason I need this is because the 'Line1' connections use different names and they resemble the 'Line4' naming convention.ANY HELP???? |
|
|
bitsmed
Aged Yak Warrior
545 Posts |
Posted - 2012-06-20 : 18:29:38
|
| I belive your sql server is oracle - if so, your topic belongs to another forum, as this is for ms sql.Anyway, you would want to take a closer look at the substr function, and return 2 chars instead of one. Also you would not use the 'like' token if you know the whole string (as it looks like you do i error_text field - something like:my $sql = qq{ select Connection_symbol, Name_0, decode(substr(name_0, 1,2), 'K?', 'Line1', '3?', 'Line2', 'P?', 'Line3', '5?', 'Line4', 'No Pattern') from p_connections where error_text = 'SYS disconnected' and connection_symbol like '%SYS'}; |
 |
|
|
fdj1975
Starting Member
2 Posts |
Posted - 2012-06-21 : 08:19:18
|
| I apologize. You are correct, this is Oracle. Been a long day. Thank you for the answer. |
 |
|
|
|
|
|
|
|