Path: dp-news.maxwell.syr.edu!spool.maxwell.syr.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!news.n-ix.net!news2.arglkargh.de!noris.net!newsfeed.hanau.net!news-fra1.dfn.de!news.tele.dk!feed118.news.tele.dk!postnews.google.com!e56g2000cwe.googlegroups.com!not-for-mail
From: "Harry331" <harryooopotter@hotmail.com>
Newsgroups: comp.databases.oracle.misc
Subject: Re: update a date field with fixed date but random hours/minutes
Date: 3 Mar 2006 15:14:34 -0800
Organization: http://groups.google.com
Lines: 28
Message-ID: <1141427674.808636.229410@e56g2000cwe.googlegroups.com>
References: <1141410442.740870.319880@t39g2000cwt.googlegroups.com>
   <44088e35$0$21544$626a54ce@news.free.fr>
   <1141412997.576909.165100@i40g2000cwc.googlegroups.com>
   <6vOdnS8L37SBB5XZRVn-sw@comcast.com>
   <1141417260.685120.208030@u72g2000cwu.googlegroups.com>
   <1141418544.155679.294300@u72g2000cwu.googlegroups.com>
   <pdednc-tMqQPKJXZnZ2dnUVZ_sadnZ2d@comcast.com>
   <1141423068.302113.240200@e56g2000cwe.googlegroups.com>
   <L8qdnbL_w-FgXpXZnZ2dnUVZ_vidnZ2d@comcast.com>
NNTP-Posting-Host: 139.177.224.128
Mime-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
X-Trace: posting.google.com 1141427679 30851 127.0.0.1 (3 Mar 2006 23:14:39 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Fri, 3 Mar 2006 23:14:39 +0000 (UTC)
In-Reply-To: <L8qdnbL_w-FgXpXZnZ2dnUVZ_vidnZ2d@comcast.com>
User-Agent: G2/0.2
X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322),gzip(gfe),gzip(gfe)
X-HTTP-Via: 1.0 winproxy02 (NetCache NetApp/5.3.1R2)
Complaints-To: groups-abuse@google.com
Injection-Info: e56g2000cwe.googlegroups.com; posting-host=139.177.224.128;
   posting-account=gOpqYQwAAACSz9nNCAX2z-ED9aom0UZf
Xref: dp-news.maxwell.syr.edu comp.databases.oracle.misc:125692

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.

