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

Home -> Community -> Usenet -> c.d.o.server -> Dates and Random Numbers in PL/SQL?

Dates and Random Numbers in PL/SQL?

From: Jason C Miller <jm+_at_andrew.cmu.edu>
Date: 1997/06/03
Message-ID: <InYvBVK00YUu0Pw2I0@andrew.cmu.edu>#1/1

Hi,

 I'm starting my first sizable effort in PL/SQL programming and I'm stuck against two small walls. (My configuration is Oracle 7.3 and Oracle Webserver Cartridges).

 One thing I want to do is easily work with dates. I've seen functions to change the date, but not times (except for the time zone stuff). I'd like to write a function that does the following:   new_date := old_date + hours + minutes; Ie. I'd like to take a date and add an hour and/or minutes to it. I realize I could do this by converting it to a character string and doing all kinds of manipulations with it-- is there an easier way?

  Secondly, I'd like to generate _large_ highly random numbers. The random.rndint() utility with OWS2.1 generates randoms, but it seems to have problems generating any number beyond 9999. I'd like to generate a number between 0 and 10^9 if possible. I am currently planning to do this by generating a number of them and concat'ing them together. Are there any public domain routines for generating integers?

  Lastly, a general question: is anyone doing anything inventive for testing PL/SQL statements? Currently I've been doing stuff like:

SQL> declare

      foobar number;
     begin
      foobar := mypackage.myfunct(242);
      insert into temp values(tochar(foobar));
     end;

and such. I cannot believe there isn't a nice utility I should be using to get the return values printed out to my display?

I'd appreciate any help that you can offer. Many thanks for reading.

Regards,
Jason


|\\|        Jason Miller             |//| jm_at_andrew.cmu.edu   VOX  412/862-3576
|//| Information Systems & Comp Sci  |\\| jason_at_halotech.com  BIZ  412/361-HALO
|\\|   Carnegie Mellon University    |//|                     FAX  412/361-8399
   In the end we will conserve only what we love, we will love only what we
          understand, we will understand only what we are taught.
Received on Tue Jun 03 1997 - 00:00:00 CDT

Original text of this message

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