ORA-01912: ROW keyword expected

文档解释

ORA-01912: ROW keyword expected

Cause: keyword missing

Action: supply missing keyword

官方解释

当一个表的列的行元素未被正确指定时,将报告此错误。

常见案例

1. 在执行INSERT语句时,在VALUES子句中缺少ROW关键字:

INSERT INTO orders (order_id, customer_name) VALUES (100, ‘John Smith’);

2. 在执行MERGE语句时,在USING子句中缺少ROW关键字:

MERGE INTO orders t

USING new_orders s

ON (t.order_id = s.order_id)

WHEN MATCHED THEN

UPDATE SET t.customer_name = s.customer_name

WHEN NOT MATCHED THEN

INSERT(order_id, customer_name) VALUES (s.order_id, s.customer_name);

正常处理方法及步骤

1. 检查INSERT或MERGE语句,确认每一行是否指定行元素。

2. 为每一行添加ROW关键字,例如:

INSERT INTO orders (order_id, customer_name) VALUES ROW (100, ‘John Smith’);

MERGE INTO orders t

USING new_orders s

ON (t.order_id = s.order_id)

WHEN MATCHED THEN

UPDATE SET t.customer_name = s.customer_name

WHEN NOT MATCHED THEN

INSERT(order_id, customer_name) VALUES ROW (s.order_id, s.customer_name);

你可能感兴趣的