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
Post a Comment