Oracle Call Interface Programmer's Guide Release 2 (9.2) Part Number A96584-01 |
|
OCI Cartridge Functions, 43 of 43
/* This example shows the power of arbitrary argument */ /* selection in the context of internationalization. A */ /* date is formatted in 2 different ways for 2 different */ /* countries according to the format string yet the */ /* argument list submitted to OCIFormatString remains */ /* invariant. */ text buffer[255]; ub1 day, month, year; OCIError *err; dvoid *hndl; /* Set the date. */ day = 10; month = 3; year = 97; /* Work out the date in United States' style: mm/dd/yy *:/ OCIFormatString(hndl, err, buffer, (sbig_ora)sizeof(buffer), (CONST text *)"%(2)02u/%(1)02u/%(3)02u", OCIFormatUb1(day), OCIFormatUb1(month), OCIFormatUb1(year), OCIFormatEnd); /* Buffer is "03/10/97". */ /* Work out the date in New Zealand style: dd/mm/yy *:/ OCIFormatString(hndl, err, buffer, (sbig_ora)sizeof(buffer), (CONST text *)"%(1)02u/%(2)02u/%(3)02u", OCIFormatUb1(day), OCIFormatUb1(month), OCIFormatUb1(year), OCIFormatEnd); /* Buffer is "10/03/97". */
|
Copyright © 1996, 2002 Oracle Corporation. All Rights Reserved. |
|