Columna no permitida aquí error
Frecuentes
Visto 7,564 veces
0
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
CUSTOMER_ID NUMBER(4)
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"
*Cause:
*Action:
1 Respuestas
1
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 sql oracle10g runtime-error or haz tu propia pregunta.
Why do have single quotes here : '&customer_id' ? - Lokesh
@Lokesh, I removed the single quotes and tried to insert the above values, however the error still persists! - Mistu4u
On which sql client are you executing this sql? - Lokesh
@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. - Mistu4uTry adding quotes on date field. The date format may be '12-Mar-2013'. - laksys