Hi all, i want to insert Date as following: insert into db values('12/03/2006'); Error: Not a valid month can anyone help me? (oracle 10g)
I tried it but i still fail. now i am to_date function : Insert into db values(to_date('" + ReportDate.Text + "','dd/mm/yyyy')); The Date will be inserted into database successfully with the inputed format "12/03/2007". However, the output format was not one i expected. Output format: 12/3/2007 0:00:00 How to delete those unwanted string "0:00:00"
to remove unwanted string which represents time you can do a "trunc(<date_column>)" when displaying the date column. also, doing a "to_char(<date_column>,'dd/mm/yyyy')" will work.
The default format for date in oracle is DD-MON-RR. so you can write insert statement as following insert into table (bdate) values ('18-JUN-84'); column name is bdate and value is '18-JUN-84'
use TO_CHAR function and convert your date format as you want (as long as it is valid format): example: select to_char(sysdate,'dd/Mon/yyyy') from dual - to display date in DD/Mon/YYYY format. No time displayed. select to_char(sysdate,'dd-Mon-yyyy') from dual - to display date in DD-Mon-YYYY format. No time displayed. select to_char(sysdate,'dd-Mon-yyyy hh24:mi:ss') from dual - will display date and time in hh24:mi:ss format.
take help from some online tutorial. ask it from the author of that tutorial it may solve your problem
This is what you want in the database: insert into db values('12/03/2006'); Here is what you need to do: Method 1: insert into db (target_column_name) values (to_date('12/03/2006','mm/dd/yyyy')); Method 2: insert into db values (to_date('12/03/2006','mm/dd/yyyy')); Method 1 is the preferred way because the target column is named. Target columns should always be named. Inserting into a table without naming the target columns is a bug waiting to happen.