Welcome to the dBforums forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact support.

If you prefer not to see double-underlined words and corresponding ads, place your cursor
here for ContentLink opt out.

Go Back  dBforums > Database Server Software > Oracle > date format

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-30-04, 03:10
sajusv sajusv is offline
Registered User
 
Join Date: Jul 2004
Posts: 34
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;
Reply With Quote
  #2 (permalink)  
Old 09-30-04, 03:30
namliam namliam is offline
Registered User
 
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
Reply With Quote
  #3 (permalink)  
Old 09-30-04, 05:46
sajusv sajusv is offline
Registered User
 
Join Date: Jul 2004
Posts: 34
HI Greetz
Thank you very much . Thank you
Reply With Quote
  #4 (permalink)  
Old 09-30-04, 19:11
WilliamR WilliamR is offline
Registered User
 
Join Date: Sep 2004
Location: London, UK
Posts: 564
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;
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On