Parameter binding problem

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Hamid

Parameter binding problem

Post by Hamid » Thu 12 May 2005 08:40

I need to open one query in run time whit dynamic parameter binding, but it dosn't work and no record exist in result set .(similar code works whit BDE and some records in result set). furthermore similar query whit no parameters (static parameter binding in sql command) works in my code.
my query has one parameter whit String type.
please tell me your advise and expriments.

Alex
Posts: 655
Joined: Mon 08 Nov 2004 08:39

Post by Alex » Thu 12 May 2005 09:15

It's hard to understand exact cause of your problem. We need more detailed description i.e. complete sample to demonstrate it and script to create server objects. Please, send a message to our ODAC support e-mail address.

hh
Posts: 1
Joined: Thu 12 May 2005 09:12

more detailes (Hamid)

Post by hh » Thu 12 May 2005 11:21

for example this scrips has no result set:

OraSelQ->Close();
OraSelQ->SQL->Clear();
OraSelQ->SQL->Add("SELECT f1,f2 FROM t1 where f3=:1");
OraSelQ->Params->Items[0]->DataType = ftString;
OraSelQ->Params->Items[0]->AsString = "ABC";
OraSelQ->Open(); ==> this dataset is empty

but this two scripts have some records in result set :

OraSelQ->Close();
OraSelQ->SQL->Clear();
OraSelQ->SQL->Add("SELECT f1,f2 FROM t1 where f3='ABC' ");
OraSelQ->Open(); ==> this dataset has some records

or this one:
OraSelQ->Close();
OraSelQ->SQL->Clear();
OraSelQ->SQL->Add("SELECT f1,f2 FROM t1 where f3 like :1 ");
OraSelQ->Params->Items[0]->DataType = ftString;
OraSelQ->Params->Items[0]->AsString = "ABC%";
OraSelQ->Open(); ==> this dataset has some records

all of this samples works whit BDE components and have some records.

Alex
Posts: 655
Joined: Mon 08 Nov 2004 08:39

Post by Alex » Fri 13 May 2005 07:08

I couldn't reproduce your problem, I have tested it on C++Builder 5 and 6, ODAC 5.50.1.18 against Scott.EMP table and always got satisfactory results, the test sample was

Code: Select all

// TOraQuery *OraSelQ;
OraSelQ->Close();
OraSelQ->SQL->Clear();
OraSelQ->SQL->Add("select mgr, empno from emp where ename=:1");
OraSelQ->Params->Items[0]->DataType = ftString;
OraSelQ->Params->Items[0]->AsString = "JONES";
OraSelQ->Open();
Please specify your exact ODAC version, IDE version, Oracle Client/Server version and send us small sample that demonstrates your problem with scripts to create server objects.

Post Reply