It does not give back I number of a sequence with Session.Options.Net: = TRUE

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
natal
Posts: 5
Joined: Mon 08 Aug 2005 16:23

It does not give back I number of a sequence with Session.Options.Net: = TRUE

Post by natal » Sat 27 Jan 2007 20:09

I am working with D6, Oracle 9i and 4.50.4.25 components, and have the following problem when attempt to obtain a number of sequence with Session.Options.Net: = TRUE.

I have the following instructions in ORACLE:

Code: Select all

CREATE OR REPLACE TRIGGER "DESARROLLO"."TA_LIQ_GENERAR_NUM_ORDEN"
BEFORE  INSERT
OR UPDATE OF "N_NUM_ORDEN" ON "TA_LIQUIDACIONES" FOR EACH ROW begin
   if :new.n_num_orden is null then
   select TA_LIQ_NUM_ORDEN.NextVal
   into :new.n_num_orden 
   from Dual;
   end if;
end;

Code: Select all

CREATE SEQUENCE "DESARROLLO"."TA_LIQ_NUM_ORDEN" INCREMENT BY 1 
    START WITH 5000 MAXVALUE 99999 MINVALUE 1 NOCYCLE 
    NOCACHE ORDER
I have the following instructions in DELPHI6:
fdm.SmartQuery. SequenceMode = smInsert
fdm.SmartQuery.KeySequence :='DESARROLLO.TA_LIQ_NUM_ORDEN';
fdm.SmartQuery.Keyfields := 'n_num_orden';
fdm.SmartQuery.Refreshoptions := [roAfterUpdate];

Code: Select all

procedure  TfLiq.grabaSQLliq;  
begin
  fdm.SmartQuery.SQL.clear;
  fdm.SmartQuery.SQL.Text:=
  'INSERT INTO Desarrollo.ta_liquidaciones '+#13+
  '(C_NUM_OFICINA, N_NUM_YEAR, N_NUM_ORDEN)'+#13+
  ' VALUES '+#13+
  '(:C_NUM_OFICINA, :N_NUM_YEAR, :N_NUM_ORDEN)'+#13+
  'RETURNING'+#13+   
  ' N_NUM_ORDEN'+#13+
  'INTO'+#13+
  ' :N_NUM_ORDEN';

   fdm.SmartQuery.ParamByName('C_NUM_OFICINA').AsString  := Num_oficina.text;
   fdm.SmartQuery.ParamByName('N_NUM_YEAR').AsString       := Num_year.text;
   fdm.SmartQuery.ParamByName('N_NUM_ORDEN').AsString    := Num_Orden.Text;

   fdm.SmartQuery.prepared;
   fdm.SmartQuery.execute;

  *************************
  Here it is the error, does not give back the sequence for  N_NUM_ORDEN
  ************************

  Num_orden.text:= fdm.SmartQuery.ParamByName('N_NUM_ORDEN').AsString;

end;
This works well connected Session.Options.Net: = FALSE but we changed to TRUE, then fault giving the following error:

ORA-01722: invalid number
ORA-06512: at line 1

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Tue 30 Jan 2007 10:52

We cannot reproduce the problem. Please send to ODAC support address complete sample that demonstrates the problem and include script to create server objects.

Post Reply