Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/68.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/wcf/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql 将日期类型值插入Oracle中的表:ORA-00984_Sql_Oracle - Fatal编程技术网

Sql 将日期类型值插入Oracle中的表:ORA-00984

Sql 将日期类型值插入Oracle中的表:ORA-00984,sql,oracle,Sql,Oracle,我根据下图创建了两个表: 我现在正试图用测试数据填充这些表,但在将日期类型列插入PositionLogEntry表时遇到了问题,出现了一个错误:PL/SQL:ORA-00984:此处不允许使用列 注意,航班表填写正确。 你能提出一些可能的解决办法吗? 谢谢 在VALUES子句中不能使用列名:AIRCRAFTREGISTRATION、DateandTimeDeafation等 使用 相反。您不能在VALUES子句中使用列名:AIRCRAFTREGISTRATION、Date和TimeDeafati

我根据下图创建了两个表:

我现在正试图用测试数据填充这些表,但在将日期类型列插入PositionLogEntry表时遇到了问题,出现了一个错误:PL/SQL:ORA-00984:此处不允许使用列

注意,航班表填写正确。 你能提出一些可能的解决办法吗?
谢谢

在VALUES子句中不能使用列名:AIRCRAFTREGISTRATION、DateandTimeDeafation等

使用


相反。

您不能在VALUES子句中使用列名:AIRCRAFTREGISTRATION、Date和TimeDeafation等

使用


相反。

如果这是一篇Oracle文章,为什么我会在那里看到MySQL标签?????正确标记!!!如果这是一篇Oracle文章,为什么我会在那里看到MySQL标签?????正确标记!!!谢谢,成功了!但现在我遇到了另一个问题:ORA-00001:惟一约束SYS.SYS_C0010701在第22 00001行违反了ORA-06512:。00000-违反了唯一约束%s.%s*原因:UPDATE或INSERT语句试图插入重复的密钥。对于在DBMS MAC模式下配置的受信任Oracle,如果在不同级别存在重复条目,则可能会看到此消息*操作:删除唯一约束或不插入键。@MarcusStenberg:这与问题无关,因为您在具有唯一约束的列上插入重复值。您必须弄清楚为什么会发生这种情况。我们可能无法在这里帮助您,因为这可能是数据/编码逻辑问题。谢谢,它成功了!但现在我遇到了另一个问题:ORA-00001:惟一约束SYS.SYS_C0010701在第22 00001行违反了ORA-06512:。00000-违反了唯一约束%s.%s*原因:UPDATE或INSERT语句试图插入重复的密钥。对于在DBMS MAC模式下配置的受信任Oracle,如果在不同级别存在重复条目,则可能会看到此消息*操作:删除唯一约束或不插入键。@MarcusStenberg:这与问题无关,因为您在具有唯一约束的列上插入重复值。您必须弄清楚为什么会发生这种情况。我们可能无法在这里帮助您,因为这可能是数据/编码逻辑问题。
declare

noOfFlights constant int:= 10; noOfLog constant int:=100;

begin

for m in 1..noOfFlights loop

insert into Flight (aircraftRegistration, DateAndTimeDeparture,pilotInCommand) values ( 'Aircraft Registration' || to_char(sqFlight.nextval), to_date('2000-01-01 00:00:00', 'YYYY-MM-DD hh24:mi:ss') + to_ymInterval(to_char(floor(dbms_random.value(1,30))) || '-' || to_char(floor(dbms_random.value(1,12)))), 'Pilot in Command' || to_char(sqFlight.currval)); end loop;

for c in 1..noOfLog loop for m in (select AIRCRAFTREGISTRATION, DATEANDTIMEDEPARTURE from Flight) loop

insert into POSITIONLOGENTRY (AIRCRAFTREGISTRATION, DATEANDTIMEDEPARTURE, logTime, positionLatitude, positionLongtitude, courseDegrees, headingDegree, horizontalSpeedKnots, verticalSpeedKnots, altitudeFeet, altitudeFlightLevels) values ( AIRCRAFTREGISTRATION, DATEANDTIMEDEPARTURE, to_date('2000-01-01 00:00:00', 'YYYY-MM-DD hh24:mi:ss') + to_ymInterval(to_char(floor(dbms_random.value(1,30))) || '-' || to_char(floor(dbms_random.value(1,12)))), round(dbms_random.value(7,0)), round(dbms_random.value(7,0)), round(dbms_random.value(3,0)), round(dbms_random.value(3,0)), round(dbms_random.value(3,0)), round(dbms_random.value(3,0)), round(dbms_random.value(4,0)), round(dbms_random.value(4,0))); end loop;

end loop;

/commit;/

end; /
m.AIRCRAFTREGISTRATION,
m.DATEANDTIMEDEPARTURE