-1

我想输入以下内容 -

ACCEPT p_cname PROMPT 'Enter Customer Name: '
ACCEPT p_cyear PROMPT 'Enter Car Year: '
ACCEPT p_color PROMPT 'Enter Car Color: '
ACCEPT p_make PROMPT 'Enter Car Make: '
ACCEPT p_model PROMPT 'Enter Car Model: '
ACCEPT p_trim PROMPT 'Enter Car Trim: '
ACCEPT p_enginetype PROMPT 'Enter Car Engine Type: '
ACCEPT p_option PROMPT 'Enter Option Name: '
ACCEPT p_ocode PROMPT 'Enter Option Code: '

然后将其添加到表中

NAME -  WANT

Name - year color model trim enginetype 'w/' Option ( ocode )

我尝试使用 -

INSERT INTO table
VALUES ('&p_cname', '&p_cyear' || ' ' || '&p_color' || ' ' || '&p_make' || ' ' || '&p_model' ||
        || ' ' || '&p_trim' || ' ' || '&p_enginetype' || ' ' || '&p_option' || '(' || '&p_ocode'      || ')');

但它不起作用。

4

1 回答 1

0

您粘贴到评论中的错误与您问题中的代码不对应。如果我执行我得到的代码:

SQL> @test
Enter Customer Name: a
Enter Car Year: b
Enter Car Color: c
Enter Car Make: d
Enter Car Model: e
Enter Car Trim: f
Enter Car Engine Type: g
Enter Option Name: h
Enter Option Code: i
old   2: VALUES ('&p_cname', '&p_cyear' || ' ' || '&p_color' || ' ' || '&p_make' || ' ' || '&p_model' ||
new   2: VALUES ('a', 'b' || ' ' || 'c' || ' ' || 'd' || ' ' || 'e' ||
old   3:     || ' ' || '&p_trim' || ' ' || '&p_enginetype' || ' ' || '&p_option' || '(' || '&p_ocode'      || ')')
new   3:     || ' ' || 'f' || ' ' || 'g' || ' ' || 'h' || '(' || 'i'      || ')')
        || ' ' || 'f' || ' ' || 'g' || ' ' || 'h' || '(' || 'i'      || ')')
        *
ERROR at line 3:
ORA-00936: missing expression

SQL>

那是因为你有两个连接运算符缺少它的第二个操作数:

'&p_model' || || ' ' || '&p_trim'

消除额外的操作员和insert工作:

'&p_model' || ' ' || '&p_trim'
于 2013-08-09T05:06:18.283 回答