I have created a table and inserted a values one row at a time. However, I am trying to populate the table using a "stored procedure" or "trigger". The values can be a random string or number. I have been researching on it, but couldn't find any related examples.
Could some please provide an example or suggest some reference to it? Cheers!!
CREATE TABLE BOOKING
(
BOOKING_ID VARCHAR2(7) PRIMARY KEY
, BOOKING_DATE DATE
, BRANCH_ID VARCHAR2(7)
, ROOM_PRICE NUMBER(15)
, IS_BOOKED VARCHAR(5))
TABLESPACE TS02
PCTFREE 20 PCTUSED 70
STORAGE (INITIAL 200K NEXT 500K PCTINCREASE 20);
--to insert value to BOOKING table for one row per at a time
INSERT INTO BOOKING
VALUES ('HIM001','02-FEB-2016','KTM',500,'NO');
Best Answer
You can do it with simple SQL statements and DBMS_RANDON as demonstrated below:
Here are some good examples of using DBMS_RANDOM PL/SQL Package.