简体   繁体   中英

SAS/Oracle SQL DATEPART() with one argument

I am converting some Oracle SQL (From an antiquated SAS environment) queries to PostgreSQL. Before I can figure out what exactly the PostgreSQL equivalent to DATEPART() and how it works is, I need to find out what the Oracle query is doing to better understand it. In a select statement, I have two parts of the query which look very similar to one another.

SELECT DISTINCT
/*...*/
DHMS(DATEPART(a.process_date),0,0,0) FORMAT datetime20. AS Pic_Proc_Dt,
/*...*/
DHMS(DATEPART(b.process_date),0,0,0) FORMAT datetime20. AS RESP_Proc_Dt,
/*...*/

In particular, I don't understand Oracle's use of the DATEPART call with only one argument. All of the resources I can find online say that you need to use two arguments in DATEPART to make it work, but this is only taking one, and this code has been running for close to 8 years.

Because I am not authorized to see the Oracle database and data inside of it, I can't make any small selections on the related table to see what exactly the data in that column looks like. But, that aside, the DATEPART function should still be taking two arguments.

What would DATEPART(arg) return, if there was only one parameter/argument sent to it?

Thanks.

This looks like it is a sas function. The sas datepart takes only one parameter. http://support.sas.com/documentation/cdl/en/lefunctionsref/63354/HTML/default/viewer.htm#p0rttbu7w62xgzn1damccyuwpld8.htm

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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