10.12.2012 Views

Oracle C++ Call Interface Programmer's Guide

Oracle C++ Call Interface Programmer's Guide

Oracle C++ Call Interface Programmer's Guide

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Timestamp Class<br />

The following code example demonstrates that the default constructor creates a null<br />

value, and how you can assign a non null value to a timestamp and perform<br />

operations on it:<br />

Environment *env = Environment::createEnvironment();<br />

//create a null timestamp<br />

Timestamp ts;<br />

if(ts.isnull())<br />

cout executeQuery("select order_date from orders<br />

where customer_id=1");<br />

rs->next();<br />

//retrieve the timestamp column from result set<br />

Timestamp ts=rs->getTimestamp(1);<br />

//check timestamp for null<br />

if(!ts.isNull())<br />

{<br />

//get the timestamp value in string format<br />

string tsstr=ts.toText("dd/mm/yyyy hh:mi:ss [tzh:tzm]",0);<br />

OCCI Classes and Methods 8-215

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!