CREATE TABLE SCATTER_DATA
(
UC_NO VARCHAR2(20)
, X_P_START NUMBER
, X_P_END NUMBER
, Y_P_START NUMBER
, Y_P_END NUMBER
)
/
INSERT INTO "SCATTER_DATA" (UC_NO, X_P_START, X_P_END, Y_P_START, Y_P_END) VALUES ('UC 1', '1', '3', '1', '4')
/
INSERT INTO "SCATTER_DATA" (UC_NO, X_P_START, X_P_END, Y_P_START, Y_P_END) VALUES ('UC 2', '4', '5', '1', '3')
/
CREATE TABLE EMP
(
CODE NUMBER
, NAME VARCHAR2(20)
, UC_NO VARCHAR2(20)
)
/
INSERT INTO "TTIME"."EMP" (CODE, NAME, UC_NO) VALUES ('1', 'ABC 1', 'UC 1')
/
INSERT INTO "TTIME"."EMP" (CODE, NAME, UC_NO) VALUES ('2', 'ABC 2', 'UC 1')
/
INSERT INTO "TTIME"."EMP" (CODE, NAME, UC_NO) VALUES ('3', 'ABC 3', 'UC 1')
/
INSERT INTO "TTIME"."EMP" (CODE, NAME, UC_NO) VALUES ('4', 'ABC 4', 'UC 2')
/
SELECT E.CODE,
E.NAME,
E.UC_NO,
ROUND(DBMS_RANDOM.VALUE(S.X_P_START,S.X_P_END),2) X_POSITION,
ROUND(DBMS_RANDOM.VALUE(S.Y_P_START,S.Y_P_END),2) Y_POSITION
FROM EMP E,
SCATTER_DATA S
WHERE S.UC_NO=E.UC_NO
/