| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.misc -> Re: update a date field with fixed date but random hours/minutes
Mark C. Stock wrote:
[snip]
> this is all you need:
>
>
> update study s
> set s.my_exam_date_time =
> to_date(to_char(sysdate -1,'YYYY-MM-DD')
> ||' '
> ||trunc(dbms_random.value(0,24))
> ||':'
> ||trunc(dbms_random.value(0,60)),
> 'YYYY-MM-DD hh24:mi')
> where
> s.my_exam_date_time >= date '2006-01-01'
> and s.my_exam_date_time < date '2006-03-01'
>
>
> so, compary this with your code and figure out what parts of your code were
> unnecessary, then go buy tom kyte's book and study it before you do much
> more SQL programming... you're getting it to work, but you'll do better if
> you get a better feel for how the language is best designed to work
I now understand the effect of subqueries which made my previous query not working.
Thanks for your advices. Received on Fri Mar 03 2006 - 17:14:34 CST
![]() |
![]() |