[NTLUG:Discuss] OT Oracle date question on UNIX with OCI

Fred James fredjame at fredjame.cnc.net
Thu Dec 13 15:05:12 CST 2007


Eric Schnoebelen wrote:

>Fred James writes:
>- All
>- UNIX is the only forgiving factor - otherwise this is OT, but I should 
>- appreciate any help you may be able to offer
>- 
>- select date ..... and then pass it to an external procedure (OCI) ... 
>- but in the end I need to print the date and time as "mm/dd/yyyy 
>- HH:MM:SS" ... right now all I can get is "DD-MON-YY"
>
>- Database: Oracle 8.0.4.1
>
>wow, a moderately antique version of oracle..
>
>are you returning a date type from your external proceedure?
>
>If so, use the SQL function to_char() to format it in the
>fashion you wish (assuming this is in PL/SQL or SQL.)
>
>The interesting arguments to to_char are:
>
>	to_char(<variable>, <format string>)
>
>eg:
>	to_char(<variable>, 'MM/DD/YYYY HH12:MI:SS');
>
>--
>Eric Schnoebelen		eric at cirr.com		http://www.cirr.com
>	    I used to suffer from multiple personality disorder.
>		      However, we're much better now...
>  
>
Eric Schnoebelen
In this case a PL/SQL procedure calls the external procedure 
(package/package body) with a number of parameters/arguments, one of 
which is a date.  At the moment the external procedure is receiving it 
as a VARCHAR2 (STRING).  I have tried defining it as DATE (DATE), but 
that returns compilation errors.
Regards
Fred James




More information about the Discuss mailing list