dbTalk Databases Forums  

ORACLE TRANSLATE function VS ASA ?????? function

sybase.public.sqlanywhere.general sybase.public.sqlanywhere.general


Discuss ORACLE TRANSLATE function VS ASA ?????? function in the sybase.public.sqlanywhere.general forum.



Reply
 
Thread Tools Display Modes
  #11  
Old   
Daniel Coppersmith
 
Posts: n/a

Default Re: ORACLE TRANSLATE function VS ASA ?????? function - 04-05-2006 , 10:44 PM






You betcha! That was automated too and is available as an add on
package dubbed "RTFM".



Andrew Giulinn wrote:
Quote:
Good grief - you're right!

See you then - I'm off to the pub.

I assume your work comes with 24/7 support Daniel?

"Breck Carter [Team iAnywhere]" <NOSPAM__bcarter (AT) risingroad (DOT) com> wrote in
message news:h1d732lg8ep5a6a2h1vdneli98oe0b5u5i (AT) 4ax (DOT) com...
On 4 Apr 2006 20:21:11 -0800, "Andrew Giulinn"
NO.oscar.SPAM (AT) NOSPAM (DOT) dsa.com.au> wrote:

Beautiful - when are you free to help out with our project?
He already has... go have a look, it's all done



--
Breck Carter [Team iAnywhere]
RisingRoad SQL Anywhere and MobiLink Professional Services
www.risingroad.com
The book:
http://www.risingroad.com/SQL_Anywhe...ers_Guide.html
breck.carter (AT) risingroad (DOT) com



Reply With Quote
  #12  
Old   
Andrew Giulinn
 
Posts: n/a

Default Re: ORACLE TRANSLATE function VS ASA ?????? function - 04-06-2006 , 09:23 PM






I knew we'd get that into this conversation eventually <g>

"Daniel Coppersmith" <daniel_AT_infrontsoftware_DOT_com (AT) N0SPAM (DOT) com> wrote in
message news:4434808f$1 (AT) forums-1-dub (DOT) ..
Quote:
You betcha! That was automated too and is available as an add on package
dubbed "RTFM".



Andrew Giulinn wrote:
Good grief - you're right!

See you then - I'm off to the pub.

I assume your work comes with 24/7 support Daniel?

"Breck Carter [Team iAnywhere]" <NOSPAM__bcarter (AT) risingroad (DOT) com> wrote in
message news:h1d732lg8ep5a6a2h1vdneli98oe0b5u5i (AT) 4ax (DOT) com...
On 4 Apr 2006 20:21:11 -0800, "Andrew Giulinn"
NO.oscar.SPAM (AT) NOSPAM (DOT) dsa.com.au> wrote:

Beautiful - when are you free to help out with our project?
He already has... go have a look, it's all done



--
Breck Carter [Team iAnywhere]
RisingRoad SQL Anywhere and MobiLink Professional Services
www.risingroad.com
The book:
http://www.risingroad.com/SQL_Anywhe...ers_Guide.html
breck.carter (AT) risingroad (DOT) com



Reply With Quote
  #13  
Old   
Chris Keating(iAnywhere Solutions)
 
Posts: n/a

Default Re: ORACLE TRANSLATE function VS ASA ?????? function - 04-07-2006 , 09:38 AM



Would this help?

create function dbo.translate
(str long varchar, orig long varchar, repl long varchar )
returns long varchar
begin
declare i int;
declare lorig int;
declare lrepl int;
declare rslt long varchar;

if str is null or orig is null or repl is null then
return null
end if;
set lorig = length( orig );
set lrepl = length( repl );
if lorig <> lrepl then
return null
end if;
set i = 1;
set rslt = str;
lp: loop
if i > lorig then leave lp end if;
set rslt = replace( rslt, substr(orig,i,1), substr(repl,i,1) );
set i = i + 1;
end loop;
return rslt
end
--

Chris Keating
Sybase Adaptive Server Anywhere Professional Version 8

************************************************** ***************************
Sign up today for your copy of the SQL Anywhere Studio 9 Developer
Edition =and try out the market-leading database for mobile, embedded
and small to medium sized business environments for free!

http://www.ianywhere.com/promos/deved/index.html

************************************************** ***************************

iAnywhere Solutions http://www.iAnywhere.com

** Please only post to the newsgroup

** Whitepapers can be found at http://www.iAnywhere.com/developer
** EBFs can be found at http://downloads.sybase.com/swx/sdmain.stm
** Use Case Express to report bugs http://case-express.sybase.com

************************************************** ***************************

Reply With Quote
  #14  
Old   
Richard Biffl
 
Posts: n/a

Default Re: ORACLE TRANSLATE function VS ASA ?????? function - 04-07-2006 , 11:58 AM



The function probably needs to handle all charcter translations
simultaneously, instead of sequentially. If I call TRANSLATE('abba', 'ab',
'ba') I would probably want to get back 'baab', but your function would give
me 'aaaa'.

I think the way to solve this is for your outer loop to go through "str" one
character at a time, and have an inner loop scan "orig" for a match on each
"str" character.

Richard

"Chris Keating(iAnywhere Solutions)"
<NoSpamPlease_k_e_a_t_i_n_g (AT) i_A_n_y_w_h_e_r_e (DOT) com> wrote

Quote:
Would this help?

create function dbo.translate
(str long varchar, orig long varchar, repl long varchar )
returns long varchar
begin
declare i int;
declare lorig int;
declare lrepl int;
declare rslt long varchar;

if str is null or orig is null or repl is null then
return null
end if;
set lorig = length( orig );
set lrepl = length( repl );
if lorig <> lrepl then
return null
end if;
set i = 1;
set rslt = str;
lp: loop
if i > lorig then leave lp end if;
set rslt = replace( rslt, substr(orig,i,1), substr(repl,i,1) );
set i = i + 1;
end loop;
return rslt
end
--

Chris Keating
Sybase Adaptive Server Anywhere Professional Version 8


************************************************** **************************
*
Quote:
Sign up today for your copy of the SQL Anywhere Studio 9 Developer
Edition =and try out the market-leading database for mobile, embedded
and small to medium sized business environments for free!

http://www.ianywhere.com/promos/deved/index.html


************************************************** **************************
*
Quote:
iAnywhere Solutions http://www.iAnywhere.com

** Please only post to the newsgroup

** Whitepapers can be found at http://www.iAnywhere.com/developer
** EBFs can be found at http://downloads.sybase.com/swx/sdmain.stm
** Use Case Express to report bugs http://case-express.sybase.com


************************************************** **************************
*




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.