Results 1 to 4 of 4

Thread: date format

  1. #1
    Join Date
    Jul 2004
    Posts
    34

    Unanswered: date format

    Hi every body
    I am using a stored procedure to insert values into a table which contain a date datatype. I pass the date in MM-DD-YYYY format.
    When i execute the querry it shows error invalid month.

    create or replace procedure sample_I
    (
    P_no varchar2,
    P_date date
    )
    as
    begin
    insert into sample values(P_no ,to_date(P_date,'MM-DD-YYYY' ));
    end;

  2. #2
    Join Date
    Jan 2004
    Location
    The Netherlands
    Posts
    421
    Try passing the date into a string value

    create or replace procedure sample_I
    (
    P_no varchar2,
    P_date varchar2
    )

    This way there are no implicit conversions. If your P_Date is allready a date there is no need to use the To_Date function in your insert statement.

    Greetz

  3. #3
    Join Date
    Jul 2004
    Posts
    34
    HI Greetz
    Thank you very much . Thank you

  4. #4
    Join Date
    Sep 2004
    Location
    London, UK
    Posts
    565
    Well, if you are already working with Oracle DATE values (as you should) then your procedure is simply
    Code:
    CREATE OR REPLACE PROCEDURE sample_I
        ( p_no   VARCHAR2
        , p_date DATE )
    AS
    BEGIN
        INSERT INTO sample
        ( col1
        , col2 )
        VALUES
        ( p_no
        , p_date );
    end;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •