-
I received this advice re: whether you can use to_char on insert
Sure, just insert:
... to_char( :date_field, 'yyyymmddhh24miss' ) ....
and select out
to_date( date_column, 'yyyymmddhh24miss' )
when I try to use to_char on the insert I receive a column not allowed error message. Is the advice above really suggested a PL/SQL procedure? How to assign my date_val to the :date_field?
-
SQL> create table testdate (a varchar2(50)) tablespace users;
Table created.
SQL> insert into testdate select To_char(sysdate) from dual;
1 row created.
SQL> commit;
Commit complete.
SQL> select * from testdate;
A
--------------------------------------------------
11-MAY-01
SQL> select to_date(a) from testdate;
TO_DATE(A
---------
11-MAY-01
Is this what you can't do?
-
If you are converting the field back to a date in order to output it, why are you attempting to store it in a character field?
Seems to me that it would be easier to just store the date field as a date, and then there would be no need for conversion.
HTH
David.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|