My Oracle Support Banner

OCI : How To Decode DATE Avoiding TO_CHAR() Function (Doc ID 1349901.1)

Last updated on JUNE 27, 2023

Applies to:

Oracle Cloud Infrastructure - Database Service - Version N/A and later
Oracle Database Cloud Service - Version N/A and later
Oracle Database - Enterprise Edition - Version 8.0.6.0 and later
Oracle Database Cloud Schema Service - Version N/A and later
Oracle Database Exadata Express Cloud Service - Version N/A and later
Information in this document applies to any platform.

Goal

This note describes how to decode DATE datatype by avoiding TO_CHAR() using OCI. Fetching a DATE datatype using OCI requires to allocate a chunk of 4 unsigned bytes  (ub1) as bind variable. To decode day, month and year following equations have to be used: 

Solution

To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!


In this Document
Goal
Solution
 Requirements
 Configuring
 Instructions
 Sample Code
 Sample Output
References


My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.