Precompilers and OCI (MOSC)

MOSC Banner

Inserting negative OCIInterval (YEAR(5) TO MONTH) is not equal to interval literal equivalent

edited Feb 11, 2010 6:17PM in Precompilers and OCI (MOSC) 14 commentsAnswered
Hi all,
I have a table with an INTERVAL YEAR(5) TO MONTH column and I try to insert values with OCIInterval handles.

I could not find a clear description in the documentation about setting the value of an OCIInterval...

After some tries it appears that you have to initialize the OCIInterval with OCIIntervalFromText() to "00-00" (otherwise you get ORA-01873).
Then you can set the year and month parts with OCIIntervalSetYearMonth().

If the value is negative like -55555-11, I call OCIIntervalSetYearMonth() with year=-55555 and month=11 ...

The value seems to insert properly (SELECT from sqlplus shows -55555-11, SELECT ... WHERE col = ? with same OCIInterval use for INSERT returns the row).

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