Precompilers and OCI (MOSC)

MOSC Banner

pro*c timestamp type

edited Oct 5, 2015 5:43AM in Precompilers and OCI (MOSC) 1 commentAnswered

HI.

Here is how i operate with data in my pro*c program (internal type code = 12):

int convert_date(char* date, char* dest) {                
    sprintf(dest,
            "%d%d.%s%d.%s%d %s%d:%s%d:%s%d",
            date[0]>=0?date[0]-100:date[0]+256-100,
            date[1]>=0?date[1]-100:date[1]+256-100,
            date[2]<=9?"0":"",date[2],
            date[3]<=9?"0":"", date[3],
            date[4]-1<=9?"0":"", date[4]-1,
            date[5]-1<=9?"0":"", date[5]-1,
            date[6]-1<=9?"0":"", date[6]-1);
    dest[30] = 0;
    return 0;
}

I assign a returned value to char[7] host variable.

The question is: how can i do the same with timestamp columns? (internal type == 187)?

The reason I cannot translate the value to character type (set descriptor ... type = 5 ...) is that there is some corrupted data in my database and i get a ORA-01877. That is why i have to convert date columns manually.

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center