Additional
dbCAP
AnyDAC
ThinDAC
NCOCI8
Topic: TClientdataset
TClientdataset
Posted: 2005/07/27 16:38
 
Hi,

I've tried a simple TClientDataSet-Application.
But without success.
I got:
OCI_ERROR
ORA-01036: Variablenname/-nummer ungültig

used update-sql:
update "BRUECKMANN"."TEST_CDS" set
"BETRAG" = ?
where
"WER" = ? and
"BETRAG" = ?

the error occurs in TOCIVariable.Bind
statement "Check('OCIBindByName(' + plcHldr + ')',"

It seems to me that Bind expects variables from type ":name"

Best regards
Dietmar

source of Test-Form:
________________PAS_______________________________________
unit CdsFMU;

interface
{

DROP TABLE test_cds;
CREATE TABLE test_cds (
WER VARCHAR2(7) NULL,
betrag NUMBER(8,2) NULL
)
/
INSERT INTO TEST_CDS (WER,BETRAG)
VALUES('Hase',10);

CREATE UNIQUE INDEX ux_test_cds ON test_cds (Wer)
/

}
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Grids, DBGrids, dbkDBGridO, dbkDBGridP, dbkDBGrid, ComCtrls,
dbkStatusBar, ToolWin, dbkToolBar, dbkCdsAction, ActnList, dbkFktComp,
dbkSqlListe, DB, DBClient, dbkClientDataSet, Provider, dbkDataSetProvider,
ExtCtrls, DBCtrls, StdUserMessDef, dbkTimer;

type
TForm1 = class(TForm)
acL: TCdsActionList;
acCdsSpeichern: TCdsSpeichern;
acCdsNSMDW: TCdsNSMDWAction;
acCdsVerwerfen: TCdsAction;
tlb: TdbToolBar;
stb: TdbStatusBar;
grd: TdbDBGrid;
ToolButton1: TToolButton;
ToolButton2: TToolButton;
ToolButton3: TToolButton;
sc: TDataSource;
dp: TdbDataSetProvider;
c: TdbClientDataSet;
sqla: TSqlAusfuehren;
nav: TDBNavigator;
tim: TdbTimer;
procedure FormShow(Sender: TObject);
procedure timTimer(Sender: TObject);
private
procedure INIT_FORMULAR(var message: TMessage); message CM_INIT_FORMULAR;
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;

var
Form1: TForm1;

implementation

uses ConDMU;

{$R *.dfm}

procedure TForm1.FormShow(Sender: TObject);
begin
c.Oeffnen;
c.Edit;
c['BETRAG'] := c['BETRAG'] + 1;
c.Post;
PostMessage(Handle, CM_INIT_FORMULAR, 0, 0);
end;

procedure TForm1.INIT_FORMULAR(var message: TMessage);
begin
tim.Enabled := True;
end;

procedure TForm1.timTimer(Sender: TObject);
begin
acCdsSpeichern.Execute;
end;

end.
________________DFM_______________________________________
object foCds: TfoCds
Left = 575
Top = 251
Width = 376
Height = 164
Caption = 'foCds'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
OnShow = FormShow
PixelsPerInch = 96
TextHeight = 13
object tlb: TToolBar
Left = 0
Top = 0
Width = 368
Height = 29
ButtonHeight = 21
ButtonWidth = 55
Caption = 'tlb'
ShowCaptions = True
TabOrder = 0
object btn: TToolButton
Left = 0
Top = 2
Caption = 'Speichern'
ImageIndex = 0
OnClick = btnClick
end
end
object DBGrid1: TDBGrid
Left = 0
Top = 29
Width = 368
Height = 108
Align = alClient
DataSource = sc
TabOrder = 1
TitleFont.Charset = DEFAULT_CHARSET
TitleFont.Color = clWindowText
TitleFont.Height = -11
TitleFont.Name = 'MS Sans Serif'
TitleFont.Style = []
end
object con: TOCIDatabase
UserName = '?'
Password = '?'
ServerName = '?'
LoginPrompt = False
Left = 24
Top = 24
end
object q: TOCIQuery
Left = 72
Top = 24
end
object dp: TDataSetProvider
DataSet = q
Constraints = True
Left = 120
Top = 24
end
object c: TClientDataSet
Aggregates = <>
Params = <>
ProviderName = 'dp'
OnReconcileError = cReconcileError
Left = 168
Top = 24
end
object sc: TDataSource
DataSet = c
Left = 216
Top = 24
end
end
RE: TClientdataset
Posted: 2005/07/27 18:04
 
I've inspected the SQL-Monitor-log

______________________NCOCI______________________________________________
83 14:13:56 SQL Prepare: NCOCI8 - On update "TEST_CDS" set
"BETRAG" = ?
where
"WER" = ? and
"BETRAG" = ?

84 14:13:56 SQL Vendor: NCOCI8 - OCI8 - OCIHandleAlloc(OCI_HTYPE_STMT)
85 14:13:56 SQL Stmt: NCOCI8 - OCI8 - Prepare
86 14:13:56 SQL Vendor: NCOCI8 - OCI8 - OCIStmtPrepare(update "TEST_CDS" set
"BETRAG" = ?
where
"WER" = ? and
"BETRAG" = ?
)
87 14:13:56 SQL Vendor: NCOCI8 - OCI8 - OCIBindByName(

_______________________BDE_____________________________________________

225 14:51:08 SQL Transact: ORACLE - Set autocommit on/off
226 14:52:11 SQL Prepare: ORACLE - update "TEST_CDS" set
"BETRAG" = :1
where
"WER" = :2 and
"BETRAG" = :3

227 14:54:21 SQL Data In: ORACLE - Param = 1, Name = , Type = fldFLOAT, Precision = 0, Scale = 0, Data = 3.000000
228 14:54:24 SQL Data In: ORACLE - Param = 2, Name = , Type = fldZSTRING, Precision = 4, Scale = 0, Data = Hase
229 14:54:25 SQL Data In: ORACLE - Param = 3, Name = , Type = fldFLOAT, Precision = 0, Scale = 0, Data = 2.000000
230 14:54:26 SQL Execute: ORACLE - update "TEST_CDS" set
"BETRAG" = ?
where
"WER" = ? and
"BETRAG" = ?

231 14:54:26 SQL Data In: ORACLE - Rows affected = 1
____________________________________________________________________
PSExecuteStatement always gets the sql with "BETRAG" = ?
why BDE uses "BETRAG" = :1 for prepare
I don't understand.

Dietmar