Home> Database> Oracle> body text

How does Oracle determine whether data is a date?

WBOY
Release: 2022-05-25 17:12:53
Original
6763 people have browsed it

Judgment method: 1. Use "desc table name" to judge in sqlplus. This statement can display the data status in the table, including the type of each column; 2. Use "select to_char(field,'yyyy- mm-dd') from table name" statement, if the result does not report an error, it means that the data is of date type.

How does Oracle determine whether data is a date?

The operating environment of this tutorial: Windows 10 system, Oracle 11g version, Dell G3 computer.

How oracle determines whether the data is a date

Method 1: Run desc table name in sqlplus

The result is to see if the field is in date format date

desc +表名
Copy after login

Used to display the status of the table, including column name (column name), type of each column (Type), value type of each column, primary foreign key (Key)

Examples are as follows:

Input: desc xs;

How does Oracle determine whether data is a date?

Method 2: Use to_char

select to_char(字段,'yyyy-mm-dd') from 表名
Copy after login

If no error is reported, it is date

Examples are as follows:

How does Oracle determine whether data is a date?

Recommended tutorial: "Oracle Video Tutorial"

The above is the detailed content of How does Oracle determine whether data is a date?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!