Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

insert into using dbms.random.value fails with ORA-00904: "DBMS"."RANDOM"."VALUE": invalid identifie

LonelyDBASep 20 2017 — edited Sep 21 2017

Hi,

Im trying to select an ID from a table and then, using that value insert a random date like this:

DECLARE

   CURSOR c_id

   IS

      SELECT ID

        ...

this code works on its own

BEGIN

   FOR i IN c_id

   LOOP

      INSERT INTO a25.IDBAK (ID_TSTAMP)

           VALUES (

                     dbms_random.VALUE (

                        TO_DATE (DATE '2010-01-01',

                                 'YYYY-MM-DD HH:MI:SS',

                                 'J'),

                        TO_DATE (SYSDATE, 'j')));

      COMMIT;

   END LOOP;

END;

/

I get

PLS-00306: wrong number or types of arguments in call to 'VALUE'

PL/SQL: ORA-00904: "DBMS_RANDOM"."VALUE": invalid identifier

Who do I insert a random date into id_tstamp column?

Regards

TheLonelyDBA

This post has been answered by Frank Kulash on Sep 20 2017
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 19 2017
Added on Sep 20 2017
10 comments
1,626 views