[英]How to import Oracle SQL Developer export dates using SQLPlus
I export data in Oracle SQL Developer v17.2 using Tools > Database Export... .我使用 Tools > Database Export... 在 Oracle SQL Developer v17.2 中导出数据。 This gives me.sql file with sql statements.这为 me.sql 文件提供了 sql 条语句。
I then try to import it using SQLPlus v12.2.然后我尝试使用 SQLPlus v12.2 导入它。 Oracle SQL Developer generates me insert statements where time is formatted like this: to_timestamp('06.10.2021 12:30:22,593000000','DD.MM.RRRR HH24:MI:SSXFF')
. Oracle SQL 开发人员生成时间格式如下的插入语句: to_timestamp('06.10.2021 12:30:22,593000000','DD.MM.RRRR HH24:MI:SSXFF')
。 These run fine when I run them using Oracle SQL Developer.当我使用 Oracle SQL Developer 运行它们时,它们运行良好。 But when I use SQLPlus I get error:但是当我使用 SQLPlus 时出现错误:
ORA-01830: date format picture ends before converting entire input string
Is there way to make export that works with SQLPlus?有没有办法进行与 SQLPlus 一起使用的导出?
I know there is DBA view in Oracle SQL Developer but it says I don't have DBA privileges therefore I am looking to work with options that I have.我知道 Oracle SQL Developer 中有 DBA 视图,但它说我没有 DBA 权限,因此我希望使用我拥有的选项。
Your SQL Developer and SQL*Plus sessions are set up differently;您的 SQL Developer 和 SQL*Plus 会话设置不同; probably different locales, but the relevant part here is the NLS_NUMERIC_CHARACTERS
setting in each environment, which is usually inherited form the territory.可能不同的语言环境,但这里的相关部分是每个环境中的NLS_NUMERIC_CHARACTERS
设置,通常是从领土继承的。
Your to_date()
format model uses X
for the 'local radix character'.您的to_date()
格式 model 使用X
作为“本地基数字符”。 In SQL Developer that is a comma; SQL Developer 即逗号; in SQL*Plus it appears to be a period.在 SQL*Plus 中它似乎是一个句号。
If you don't want to touch the statements, you can change your SQL*Plus session to match:如果不想修改语句,可以更改 SQL*Plus session 以匹配:
alter session set NLS_NUMERIC_CHARACTERS = ',.'
db<>fiddle showing the problem and fix. db<>fiddle显示问题并修复。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.