to char code example
Example 1: sql to char
TO_CHAR( sysdate, 'YYYY-MM-DD' )
/*TO_CHAR Format Specifiers
YYYY 4-digit year
YY 2-digit year
MON Abbreviated month (Jan - Dec)
MONTH Month name (January - December)
MM Month (1 - 12)
DY Abbreviated day (Sun - Sat)
DD Day (1 - 31)
HH24 Hour (0 - 23)
HH or HH12 Hour (1 - 12)
MI Minutes (0 - 59)
SS Seconds (0 - 59)*/
Example 2: sql to char function with date
SELECT
TO_CHAR( sysdate, 'YYYY-MM-DD' )
FROM
dual;
Example 3: string to char in java
// getting single character from string..
String str="abcd";
char c=str.toChar(0);
System.out.println("output is "+c); // output is a
Example 4: convert char to char*
char c;
char *pChar = &c;