Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: update a date field with fixed date but random hours/minutes

Re: update a date field with fixed date but random hours/minutes

From: Harry331 <harryooopotter_at_hotmail.com>
Date: 3 Mar 2006 15:14:34 -0800
Message-ID: <1141427674.808636.229410@e56g2000cwe.googlegroups.com>


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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US