Home » Developer & Programmer » Precompilers, OCI & OCCI » Problems using OCCI ,get Date
Problems using OCCI ,get Date [message #128500] Tue, 19 July 2005 00:18 Go to next message
hilson
Messages: 2
Registered: July 2005
Junior Member
hi,

my OCCI environment = Environment::createEnvironment( Environment::THREADED_UNMUTEXED);

i have a proceduce p_xxx(code in number, mydate out date);

how to get mydate? if i don't want to use date object.

my source code:

Statement *stmt=connection->createStatement("BEGIN p_xxx(:code,:mydate); END;");

string mycode="123";
stmt->setString(1,mycode);
stmt->registerOutParam(2,OCCIDATE);

stmt->execute();

Date xx=getDate(2); //<---------here throw exception, ora21301 not init for object module. (i must create my environment to THREADED_UNMUTEXED )

can i use to_char function to get date ?

Statement *stmt=connection->createStatement("BEGIN p_xxx(:code,to_char(:mydate,'YYYYMMDDHH24MISS'); END;");

string mycode="123";
stmt->setString(1,mycode);
stmt->registerOutParam(2,OCCISTRING,100,"");

stmt->execute();
string mydate=stmt->getString(2);

but fail to compile! to_char(:mydate,...) is wrong.

how can i get this output Date type ?

best regard

thx all.



Re: Problems using OCCI ,get Date [message #130167 is a reply to message #128500] Thu, 28 July 2005 09:09 Go to previous messageGo to next message
kmohan
Messages: 28
Registered: July 2005
Junior Member
Use the environment in OBJECT mode. This has been relaxed in 10.2.
Re: Problems using OCCI ,get Date [message #130168 is a reply to message #130167] Thu, 28 July 2005 09:12 Go to previous messageGo to next message
kmohan
Messages: 28
Registered: July 2005
Junior Member
if you need both the modes, you can do this:
env = Environment::createEnvironment (Environment::Mode((Environment::OBJECT|Environment::THREADED_UNMUTEXED)));
icon7.gif  Re: Problems using OCCI ,get Date [message #130235 is a reply to message #130168] Thu, 28 July 2005 21:31 Go to previous message
hilson
Messages: 2
Registered: July 2005
Junior Member
thank you very much. Smile
Previous Topic: OCCI (oracle 9i)& Visual C++ 7 (createConnection -- An unhandled exception)
Next Topic: SQLPLUS commands (Shutdown an instance) using C#
Goto Forum:
  


Current Time: Tue Oct 27 13:53:57 CDT 2020