Columna no permitida aquí error

I tried to insert into an Oracle table by the following instruction:

insert into orders values (&order_id, &order_date, '&customer_id', &amount);

sin que importe desc orders es el siguiente:

Name        Null Type      
----------- ---- --------- 
ORDER_ID         NUMBER(4) 
ORDER_DATE       DATE      
AMOUNT           NUMBER(5) 

I tried to insert: order_id=110, order_date=12-march-2013, customer_id=115 and amount=1100

Este es el mensaje de error que recibo:

Error starting at line 26 in command:
insert into orders values (110, 12-march-2013, 115, 1100)
Error at Command Line:26 Column:35
Error report:
SQL Error: ORA-00984: column not allowed here
00984. 00000 -  "column not allowed here"

preguntado el 22 de septiembre de 13 a las 06:09

Why do have single quotes here : '&customer_id' ? -

@Lokesh, I removed the single quotes and tried to insert the above values, however the error still persists! -

On which sql client are you executing this sql? -

@Lokesh, Oracle SQL developer. By the way, suddenly it occured to my mind that the reason might be because the customer_id field is a foreign key to another table. This might be the reaons. -

Try adding quotes on date field. The date format may be '12-Mar-2013'. -

1 Respuestas

este código funciona

insert into orders values (200, '12-march-2013', 100, 1100)

Respondido el 22 de Septiembre de 13 a las 06:09

This is incorrect; it will only work if Oracle's feeling clever enough to translate that string into a date... and then that'll be based on your NLS_DATE_FORMAT. - paquet

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.