I have a problem where I need to update a clob field.
I have an exising value in the field which I need to convert and re update the field. I am having no luck. The data in the field currently looks like this
[2003/10/20 09:35:46][User_name] blah blah blah [2003/10/20 09:35:01][User_name] blah blah blah [2003/10/20 09:34:32][User_name] blah blah blah
I need to convert it too
1066642546.User_name.blah blah blah.1066642501.User_name.blah blah blah1066642472.User_name.blah blah blah
the "." between each field is chr('46')
The number is the date converted to epoch (19700101000000)
I use a stored proc to convert that
CREATE OR REPLACE FUNCTION date_to_unixts(oracle_date IN DATE) RETURN PLS_INTEGER IS
/**
* Converts an Oracle DATE to a UNIX timestamp
*/
unix_epoch DATE := TO_DATE('19700101000000','YYYYMMDDHH24MISS');
max_date DATE := TO_DATE('20380101000000','YYYYMMDDHH24MISS');
min_date DATE := TO_DATE('19030101000000','YYYYMMDDHH24MISS');
unix_ts PLS_INTEGER;
BEGIN
IF oracle_date > max_date THEN
RAISE_APPLICATION_ERROR( -20902,'Date too large for 32bit UNIX timestamp' );
ELSIF oracle_date < min_date THEN
RAISE_APPLICATION_ERROR( -20902,'Date too small for 32bit UNIX timestamp' );
ELSE
unix_ts := (oracle_date - unix_epoch) / (1/86400);
END IF;
Bookmarks