mardi 16 novembre 2021

How to call a function that fills all table columns with random values?

I have created a function called customers_data tha returns random values in the customers table. As far everthing compiled successfully. But when i call this

DECLARE

X_C NUMBER NOT NULL :=5 ;
Y_C NUMBER NOT NULL :=8 ;

BEGIN 

 FOR LOOP_COUNTER IN X_C..Y_C LOOP

   select * into CUSTOMERS from CUSTOMERS_DATA;

 END LOOP;

END;

THE ERROR IS:

ORA-06550

AND THE CUSTOMERS_DATA FUNCTION :

CREATE OR REPLACE FUNCTION  CUSTOMERS_DATA

RETURN NUMBER AS CR_ID NUMBER;

   BEGIN

      CR_ID := CUSTOMERS_ID_SEQ.NEXTVAL;

     INSERT INTO CUSTOMERS(CUSTOMERS_ID, CUSTOMERS_CODE )

          VALUES(CR_ID, dbms_random.string('X',10));

     
     RETURN CR_ID;

     
END CUSTOMERS_DATA;



Aucun commentaire:

Enregistrer un commentaire