Hello,
I have the below case.
CREATE TABLE "PRBT"."TM_TABLE_1"
( "NID" NUMBER,
"STRNAME" VARCHAR2(240 BYTE) NOT NULL ENABLE,
"NORDERCODE" NUMBER NOT NULL ENABLE,
"NSTATEID" NUMBER DEFAULT 1 NOT NULL ENABLE,
"STRDETAILS" VARCHAR2(256 BYTE) DEFAULT NULL,
"STRAUTHOR" VARCHAR2(128 BYTE) NOT NULL ENABLE,
"NPICTUREID" NUMBER DEFAULT NULL,
"STRLATINNAME" VARCHAR2(512 BYTE),
"STRLATINAUTHOR" VARCHAR2(512 BYTE));
CREATE TABLE "PRBT"."TM_TABLE_2"
( "NID" NUMBER,
"NUSERID" NUMBER NOT NULL ENABLE,
"NITEMID" NUMBER,
"NCOST" NUMBER DEFAULT 0 NOT NULL ENABLE,
"DTCREATED" TIMESTAMP (6) DEFAULT SYSTIMESTAMP NOT NULL ENABLE,
"DTEXPIRE" TIMESTAMP (6),
"NTIMELIMIT" NUMBER,
"LISDELETED" NUMBER DEFAULT 0 NOT NULL ENABLE,
"LLOOPBACK" NUMBER DEFAULT NULL,
"LISGIFT" NUMBER DEFAULT 0 NOT NULL ENABLE,
"NTRIALPERIOD" NUMBER,
"NTRANSACTIONID" NUMBER,
"LISSYSTEM" NUMBER DEFAULT 0 NOT NULL ENABLE,
"NORDERCODE" NUMBER
)
So, I want to insert into TM_TABLE_2.NITEMID the value of TM_TABLE_1.NID where TM_TABLE_2.NORDERCODE = TM_TABLE_1.NORDERCODE, keeping in mind that its possible to have more records inside TM_TABLE_1 than TM_TABLE_2 so I just want to insert NID's from TM_TABLE_1 into TM_TABLE for row's with NORDERCODE existed in both tables.
Any advise please!
Thanks in advance.