Home > database >  In SQL MERGE INTO statements
In SQL MERGE INTO statements

Time:09-22

The great god, help me to look at this period of SQL where is wrong? Why has been submitted to the lack of key error


The MERGE INTO TASK_STATUS_LOG t1 USING (select '1500000000' as a from dual) t2 ON (t1) MOBILE=t2) a)
WHEN NOT MATCHED THEN
Insert (MOBILE, TASK1, TASK2, TASK3, TASK3_CODE, TASK1_JOIN_TIME, TASK2_JOIN_TIME, TASK3_JOIN_TIME, EXTEND0, EXTEND1)
Values
(' 1500000000 ', '1', '0', '0', ', '2018-07-13 10:14:59', ' 'and', ', ')




CodePudding user response:

TASK_STATUS_LOG, this form of structure, also want to create table in the form of,

CodePudding user response:

We have two peng-fei Chen, don't...

CodePudding user response:

reference 1st floor wmxcn2000 response:
TASK_STATUS_LOG, this form of structure, also want to create table, in the form of



The create table TASK_STATUS_LOG
(
MOBILE VARCHAR2 (32) not null,
TASK1 VARCHAR2 (32),
TASK2 VARCHAR2 (32),
TASK3 VARCHAR2 (32),
TASK3_CODE VARCHAR2 (32),
TASK1_JOIN_TIME VARCHAR2 (32),
TASK2_JOIN_TIME VARCHAR2 (32),
TASK3_JOIN_TIME VARCHAR2 (32),
EXTEND0 VARCHAR2 (32),
EXTEND1 VARCHAR2 (32)
)
In tablespace TS_MALL_SH
Pctfree 10
Initrans 1
Maxtrans 255
Storage
(
Initial 64
Minextents 1
The maxextents unlimited
);

This is probably

CodePudding user response:

The building Lord your SQL without question, unless, that is, less is the final ";"

 SQL> The create table TASK_STATUS_LOG 
2 (
3 MOBILE VARCHAR2 (32) not null,
4 TASK1 VARCHAR2 (32),
5 TASK2 VARCHAR2 (32),
6 TASK3 VARCHAR2 (32),
7 TASK3_CODE VARCHAR2 (32),
8 TASK1_JOIN_TIME VARCHAR2 (32),
9 TASK2_JOIN_TIME VARCHAR2 (32),
10 TASK3_JOIN_TIME VARCHAR2 (32),
11 EXTEND0 VARCHAR2 (32),
12 EXTEND1 VARCHAR2 (32)
13);

The Table created.

SQL> The MERGE INTO TASK_STATUS_LOG t1 USING (select '1500000000' as a from dual) t2 ON (t1) MOBILE=t2) a)
2 the WHEN NOT MATCHED THEN
3 the insert (MOBILE, TASK1, TASK2, TASK3, TASK3_CODE, TASK1_JOIN_TIME, TASK2_JOIN_TIME, TASK3_JOIN_TIME, EXTEND0, EXTEND1)
4 values
5 (' 1500000000 ', '1', '0', '0', ', '2018-07-13 10:14:59', ', ', ', ');

1 row merged.

CodePudding user response:

The building Lord, 9 I library? If it is, you need not write all the matched,

CodePudding user response:

reference 5 floor wmxcn2000 reply:
the building Lord, 9 I library? If it is, you need not write all the matched,


CodePudding user response:

Thank you for your attention!
  • Related