插入从访问到Oracle的选择 [英] INSERT INTO SELECT FROM ACCESS TO ORACLE

查看:69
本文介绍了插入从访问到Oracle的选择的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Access中有一个名为TEST_DATE1的表,该表的TEST_DATE列是String数据类型,记录看起来像20080130.yyyymmdd

I have a table in Access named TEST_DATE1 with the column TEST_DATE that is a String datatype and the records look like 20080130. yyyymmdd

我在Oracle中有一个名为TEST的表,该表的列TEST_DATE是DATE数据类型,我希望记录看起来像2008/01/30 yyyy/mm/dd.

I have a table in Oracle named TEST with the column TEST_DATE that is a DATE datatype and I want the records to look like 2008/01/30 yyyy/mm/dd.

我链接了两个表,通常当我在Access和Oracle之间更新表时,我通常会做一个

I have the two tables linked and when I usually update tables between Access and Oracle I usually do a

INSERT INTO TEST
SELECT *
FROM TEST_DATE1;

如何使用INSERT INTO SELECT将字符串转换为DATE

How would you convert the string to a DATE using the INSERT INTO SELECT

我尝试过

INSERT INTO TEST
(SELECT TO_DATE(TEST_DATE, 'yyyy/mm/dd'))
FROM TEST_DATE1;

谢谢!

推荐答案

要将记录移至Oracle,请将字符串转换为日期:

To move the records to Oracle, converting a string to a date:

INSERT INTO test (test_date)
SELECT TO_DATE(test_date, 'YYYYMMDD')
FROM test_date1

一旦它作为日期存储在Oracle中,您就可以用任何喜欢的格式检索它:

Once it's in Oracle stored as a date, you can retrieve it in any format you like:

SELECT TO_CHAR(test_date, 'YYYY/MM/DD') as test_date
FROM test;

这篇关于插入从访问到Oracle的选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆