oracle11g

Replace last occurrence of substring

ぐ巨炮叔叔 提交于 2020-12-06 20:20:31
问题 Given this string: .ABC,.123,.FGH,.QDG How can I most-efficiently use PL/SQL to output (note the ", and"): abc, 123, fgh, and qdg So far I've got LOWER(REPLACE('.ABC,.123,.FGH,.QDG', '.', ' ')) , which yields abc, 123, fgh, qdg How do I get that "and" after "fgh,", but before "qdg" ("fgh, and qdg")? Must I use INSTR() and SUBSTR() , or is there a function that can just replace the last space with " and "? 回答1: Building on what you used already... use regexp_replace with instr with cte as(

how to get time in millisecond from date field of oracle for the date 01-01-9999

ε祈祈猫儿з 提交于 2020-12-05 12:18:12
问题 I want to get milliseconds from date field of oracle for date "01-01-9999". I have created below block to achieve the same. set serveroutput on; declare base_point constant timestamp := to_timestamp_tz('01-JAN-1970 00:00:00.000+00:00', 'DD-Mon-RR HH24:MI:SS.FFTZH:TZM') AT TIME ZONE 'UTC'; now timestamp := to_timestamp_tz('01-01-2099 00:00:00.000+00:00', 'DD-MM-RR HH24:MI:SS.FFTZH:TZM') AT TIME ZONE 'UTC'; -- now constant timestamp := systimestamp AT TIME ZONE 'UTC' ; n number; begin select to