• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Insert date into table in other format

 
Ranch Hand
Posts: 154
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

Thanks in advance.

I have created a table test with column names, name varchar2,Date1 Date.

I am trying to insert data into this table like


However when I do select it is simply showing Name1 and 10/25/2011 however I was expecting to display in 25-Oct-11 without applying again Tochar and Todate.

Please guide me.

Regards,
Sree
 
Sheriff
Posts: 3837
66
Netbeans IDE Oracle Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The date value is stored in the database in a binary (not textual) format. Format you used in the to_date() function is not stored, it is not part of the Oracle's DATE datatype. Therefore, when tools like Sqlplus need to print out a DATE value, they need to convert it to text. These conversions are guided by your current NLS (National Language Support) settings.

You can change these settings by altering corresponding session variables - in this case, the NLS_DATE_FORMAT variable, eg:
However, this is only useful in tools like Sqlplus. Do not ever rely on implicit conversions in production code (regardless of the language), as in that case your application gets easily broken as soon as the NLS settings changes.
 
It means our mission is in jeapordy! Quick, read this tiny ad!
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic