DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: What am I doing wrong?

  1. #1
    Join Date
    Aug 2000
    Posts
    132
    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?


  2. #2
    Join Date
    Aug 2000
    Posts
    462
    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?

  3. #3
    Join Date
    Feb 2001
    Posts
    123
    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
  •  


Click Here to Expand Forum to Full Width