This discussion is archived
1 Reply Latest reply: Dec 19, 2012 1:20 AM by prajithparan RSS

Problem in querying date values in prepared stmts in OCI

910885 Newbie
Currently Being Moderated
Hi,

Can you please guide me about my following problem?

I am trying to fetch the data from system table "FLOWS_020100.WWV_FLOW_ACTIVITY_LOG1$" in Oracle Express edition 10.2.0.3 database, using the OCI library on Windows with C++

This table has a TIMESTAMP column of date type.

I've the following query as below:

select TIME_STAMP from FLOWS_020100.WWV_FLOW_ACTIVITY_LOG1$ where TIME_STAMP > to_date('31/OCT/12 23:59:59', 'DD-MON-YY HH24:MI:SS') order by TIME_STAMP asc;

For this, first I am preparing the query as below:

select TIME_STAMP from FLOWS_020100.WWV_FLOW_ACTIVITY_LOG1$ where TIME_STAMP > :PKVAL order by TIME_STAMP asc;

Before calling OCIExecute(), I am setting the PKVAL buffer to following value:
"to_date('31/OCT/12 23:59:59', 'DD-MON-YY HH24:MI:SS') "

& calling the OCIBindByName function with data type as SQLT_DATE.

But when the OCIExecute is called, my program crashes with access violation

Can you please guide me what is the correct way to pass the date value in query to OCI? How do we bind the date values?

Thanks in advance for your time and help.

Best Regards.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points