oracle - SQL for extract portion of a string -


i have zipcode stored in text field (string) , select last 3 digits of value in select statement. possible? there standard way of doing sql interchangeable accross databases? using in production on oracle, test on interbase (yes, yes, know, 2 totally diff dbs, thats doing)

thanks can offer

assuming zipcodes have same length, can use substr.
if don't have same length, have similar things strlen function.

interbase not have built-in substring function, have udf (user defined function) called substr in lib_udf.dll works this:

select substr(clients.lastname, 1, 10) clients 

you declare udf this:

declare external function substr     cstring(80),     smallint,     smallint returns cstring(80) free_it entry_point 'ib_udf_substr' module_name 'ib_udf'; 

oracle have built-in substr function use this:

select substr(clients.lastname, 1, 10) clients 

--jeroen


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -