Re: Simple Pro/C Question

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: 1998/09/04
Message-ID: <3617e76a.174044202_at_192.86.155.100>#1/1


A copy of this was sent to kim_at__kiml_.demon.co.uk (if that email address didn't require changing) On Fri, 04 Sep 1998 07:50:02 GMT, you wrote:

>I'm trying to select dates into a 'C' char varaible and need to know
>how to format the dates in dd-mmm-yyyy format.
>
>Thanks in advance
>
>Kim

[Quoted] use TO_CHAR() on the date field with the format mask you want, for example

void process( int rows )
{
EXEC SQL BEGIN DECLARE SECTION;
VARCHAR str[512];
EXEC SQL END DECLARE SECTION;     EXEC SQL

        SELECT TO_CHAR( SYSDATE, 'DD-MON-YYYY' ) INTO :str
          FROM DUAL;

    printf( "%.*s\n", str.len, str.arr ); }

$ ./test
04-SEP-1998   Thomas Kyte
tkyte_at_us.oracle.com
Oracle Government
Herndon VA

--
http://govt.us.oracle.com/    -- downloadable utilities
 
----------------------------------------------------------------------------
Opinions are mine and do not necessarily reflect those of Oracle Corporation
 
Anti-Anti Spam Msg: if you want an answer emailed to you, 
you have to make it easy to get email to you.  Any bounced
email will be treated the same way i treat SPAM-- I delete it.
Received on Fri Sep 04 1998 - 00:00:00 CEST

Original text of this message