简体   繁体   English

Oracle SQL 时间/日期总是一个字符串?

[英]Oracle SQL Time/date always a String?

I'll preface this as I code primarily in Python and work with analytical tools;我将在我主要在 Python 中编码并使用分析工具时作为序言; Alteryx, Tableau, Spotfire and a few others. Alteryx、Tableau、Spotfire 和其他一些。

I've been tasked with modernizing some old etl and reporting routines was given several reports that were created in 2006. Needs updating, removing the Java functions, and pushing to the cloud.我的任务是对一些旧的 etl 进行现代化改造,并为报告例程提供了几份 2006 年创建的报告。需要更新,删除 Java 函数,并推送到云端。 The SQL was definitely a trial, whoever thought aliasing everything with single letter assignments should be shot. SQL 绝对是一个试验品,任何认为用单个字母分配混叠所有东西的人都应该被枪杀。

Complaints aside, my actual question is:::除了投诉,我的实际问题是:::

Every "Date/Time" column is set to a string.每个“日期/时间”列都设置为一个字符串。 Everyone of them.他们每个人。 Then every SQL query I have been given to modify/update uses cast to convert to a date time and then does the pull by sysdate() -X In fact almost the entirety of the Oracle DBs that I am touching almost all their data types, say 90%, are just string.然后每个 SQL 查询我被赋予修改/更新使用强制转换转换为日期时间,然后通过 sysdate() -X 进行拉动实际上几乎所有的 Oracle 数据库,我接触了几乎所有的数据类型,说90%,只是字符串。

I'm fairly new to SQL and admittedly getting used to it.我对 SQL 相当陌生,并且承认已经习惯了。 Is this normal?这是正常的吗?

It depends.这取决于。 It's not something I would usually see where I work.这不是我通常会在我工作的地方看到的东西。 The problem is, I don't know what the requirements are.问题是,我不知道要求是什么。 Maybe there was a reason to design the data model that way.也许有理由这样设计数据 model。 You'll need to see how the data is being used.您需要了解数据的使用情况。 If you change one of those strings to a date, will it break something downstream?如果您将其中一个字符串更改为日期,它会破坏下游的内容吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM