Skip to content

Commit 6043347

Browse files
committed
Added timestamp and interval unit tests.
1 parent 4fa9987 commit 6043347

File tree

1 file changed

+73
-3
lines changed

1 file changed

+73
-3
lines changed

tests/method4_test.plsql

Lines changed: 73 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -312,11 +312,81 @@ begin
312312
assert_equals('Timestamp with time zone 4.', '', actual4);
313313
end;
314314

315+
--TIMESTAMP [(fractional_seconds_precision)] WITH LOCAL TIME ZONE
316+
declare
317+
actual1 timestamp(9) with local time zone;
318+
actual2 timestamp(9) with local time zone;
319+
begin
320+
execute immediate
321+
q'<
322+
select *
323+
from table(method4.run('
324+
select
325+
cast(timestamp ''2000-01-01 12:34:56.123456789 +01:00'' as timestamp(9) with local time zone),
326+
cast(null as timestamp(9) with local time zone)
327+
from dual'))
328+
>'
329+
into actual1, actual2;
330+
331+
assert_equals('Timestamp with local time zone 1.', '123456789', to_char(actual1, 'FF9'));
332+
assert_equals('Timestamp with local time zone 2.', '', actual2);
333+
end;
334+
335+
--INTERVAL YEAR [(year_precision)] TO MONTH
336+
declare
337+
actual1 interval year to month;
338+
actual2 interval year to month;
339+
actual3 interval year to month;
340+
actual4 interval year to month;
341+
begin
342+
execute immediate
343+
q'<
344+
select *
345+
from table(method4.run('
346+
select
347+
interval ''1-1'' year to month,
348+
interval ''2'' year,
349+
interval ''3'' month,
350+
cast(null as interval year to month)
351+
from dual'))
352+
>'
353+
into actual1, actual2, actual3, actual4;
354+
355+
assert_equals('Interval year to month 1.', '+01-01', actual1);
356+
assert_equals('Interval year to month 2.', '+02-00', actual2);
357+
assert_equals('Interval year to month 3.', '+00-03', actual3);
358+
assert_equals('Interval year to month 4.', '', actual4);
359+
end;
360+
361+
--INTERVAL DAY [(day_precision)] TO SECOND [(fractional_seconds_precision)]
362+
declare
363+
actual1 interval day to second;
364+
actual2 interval day to second;
365+
actual3 interval day to second;
366+
actual4 interval day to second;
367+
begin
368+
execute immediate
369+
q'<
370+
select *
371+
from table(method4.run('
372+
select
373+
interval ''4 4'' day to hour,
374+
interval ''5:5'' minute to second,
375+
interval ''6'' second,
376+
cast(null as interval day to second)
377+
from dual'))
378+
>'
379+
into actual1, actual2, actual3, actual4;
380+
381+
assert_equals('Interval day to second 1.', '+04 04:00:00.000000', actual1);
382+
assert_equals('Interval day to second 2.', '+00 00:05:05.000000', actual2);
383+
assert_equals('Interval day to second 3.', '+00 00:00:06.000000', actual3);
384+
assert_equals('Interval day to second 4.', '', actual4);
385+
end;
386+
315387

316388
/*
317-
TIMESTAMP [(fractional_seconds_precision)] WITH LOCAL TIME ZONE
318-
INTERVAL YEAR [(year_precision)] TO MONTH
319-
INTERVAL DAY [(day_precision)] TO SECOND [(fractional_seconds_precision)]
389+
TODO:
320390
RAW(size)
321391
LONG RAW
322392
ROWID

0 commit comments

Comments
 (0)