Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How do I pass the exact datetime parameter in a procedure.

569206Mar 26 2007 — edited Mar 27 2007
How do I pass the exact datetime parameter in a procedure.

Hi All,

I have a datetime problem which is driving me crazy.

I need pass a datetime field as a parameter in an oracle procedure exactly as below with timestamp.
Example: '6/01/2005 5:25:24 AM'

SQL > exec myprod(‘value1’,’value2’,’value3’, to_date('6/01/2005 5:25:24 AM','dd-mm-yyyy hh24:mi:ss'));

I get an error “INVALID MONTH”

Next Changed to_date to to_char

SQL > exec myprod(‘value1’,’value2’,’value3’, to_char('6/01/2005 5:25:24 AM','dd-mm-yyyy hh24:mi:ss'));

I get a different error, “INVALID NUMBER”

Next pass the datetime as it is.

SQL > exec myprod(‘value1’,’value2’,’value3’, '6/01/2005 5:25:24 AM');

I get an error “INVALID MONTH”

Here is the my procedure.

CREATE OR REPLACE PROCEDURE myprod (
p_value1 varchar2,
p_value2 varchar2,
p_value3 varchar2 ,
p_value4 date )
IS
filehandler UTL_FILE.FILE_TYPE;
va_currentdate DATE;

BEGIN
SELECT sysdate
INTO va_currentdate
FROM dual;
END;

Do you know any solutions for this problem.
Thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 24 2007
Added on Mar 26 2007
4 comments
5,021 views