This is a discussion on OCCI - Timestamp within the Oracle Miscellaneous forums, part of the Oracle Database category; --> Hi I am trying to use OCI from Oracle XE when using toText with precision to minutes and secunds ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Hi I am trying to use OCI from Oracle XE when using toText with precision to minutes and secunds program breaks however when I am using only 'YYYY-MM-DD HH24' - format everything is OK string date1; Timestamp ts1; ts1.fromText("2000-02-29 11:10:10", "YYYY-MM-DD HH24:MI:SS", "", env); // date1 = ts1.toText ("YYYY-MM-DD HH24:MI:SS", 0, ""); <---- dasn't work !!!!! date1 = ts1.toText ("YYYY-MM-DD HH24", 0, ""); I am using VC++ .NET Oracle Expressedition OCI (Oracla C interface) thanks for help t. |
| |||
| t wrote: > Hi > > I am trying to use OCI from Oracle XE > > when using toText with precision to minutes and secunds program breaks > > however when I am using only 'YYYY-MM-DD HH24' - format everything is OK > > > > string date1; > Timestamp ts1; > ts1.fromText("2000-02-29 11:10:10", "YYYY-MM-DD HH24:MI:SS", "", env); > // date1 = ts1.toText ("YYYY-MM-DD HH24:MI:SS", 0, ""); <---- > dasn't work !!!!! > date1 = ts1.toText ("YYYY-MM-DD HH24", 0, ""); > > > I am using VC++ .NET Oracle Expressedition OCI (Oracla C interface) > > thanks for help > > t. > > > When you say it does not work, what exactly happens? Do you get some error message? What error message do you see? Are you sure you are using VC++7.1? -km |
| |||
| - with code as below I can convert to text but is assertion problem - when I am quiting 'while' clause ocurs assertion error when automaticly trying to delete pointer (as I gues - is during deletion of some pointer) - VC++.NET from Visual Studio version 7.1 here is an example: #include <iostream> #include "occi.h" using namespace oracle: using namespace std; int sql__(int yyy) { Environment *env; Connection *conn; Statement *stmt; string sqlStmt; string user = "HR"; string passwd = "zxzxc"; string db = "XE"; char * dataRCC = new char[20]; string tt44; std::string p1; std::string p2; int nr; env = Environment::createEnvironment (Environment: conn = env->createConnection( user, passwd, db); sqlStmt = "SELECT * FROM Tabela1"; stmt = conn->createStatement (sqlStmt); ResultSet *rset = stmt->executeQuery (); try { while (rset->next ()) { p1 = rset->getString (1); p2 = rset->getString (2); nr = rset->getInt (3); Timestamp dd = rset->getTimestamp(4); string _tt44=dd.toText("yyyy-mm-dd hh24:mi:ss",0); Number p5 = rset->getNumber(5); // string p55 = p5.toText(env, "999999999999999999.9999"); } // here crashes with assertion fails // goes to xmemory module // void deallocate(pointer _Ptr, size_type) // { // deallocate object at _Ptr, ignore size // operator delete(_Ptr); // } // and stops } catch ( SQLException ex) { cout<<"Exception thrown for insertBind"<<endl; cout<<"Error number: "<< ex.getErrorCode() << endl; int KKK = ex.getErrorCode(); cout<<ex.getMessage() << endl; } stmt->closeResultSet (rset); conn->terminateStatement (stmt); env->terminateConnection (conn); Environment::terminateEnvironment (env); delete dataRCC; return 0; } |