- changed status to duplicate
ORM Persistence: FireDacApdater Oracle database, Delphi XE7
``` #!delphi Hello, sorry for for non formated message preview
function TOracleSQLGenerator.GenerateCreateSequence(
const command: TCreateSequenceCommand): string;
var
LSequence: SequenceAttribute;
begin
LSequence := command.Sequence;
Result := 'BEGIN ';
if command.SequenceExists then
Result := Result + 'EXECUTE IMMEDIATE ' + QuotedStr(Format('DROP SEQUENCE "%0:S" ', [LSequence.SequenceName])) + ';';
//AL 18/02/2015
// Result := Result + ' EXECUTE IMMEDIATE ' + QuotedStr(Format('CREATE SEQUENCE "%0:S" MINVALUE 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY %2:D START WITH %1:D CACHE 20 NOORDER NOCYCLE',
// [LSequence.SequenceName, LSequence.InitialValue, LSequence.Increment]));
Result := Result + ' EXECUTE IMMEDIATE ' + QuotedStr(Format('CREATE SEQUENCE "%0:S" MINVALUE 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY %2:D START WITH %1:D CACHE 20 NOORDER NOCYCLE',
[LSequence.SequenceName, LSequence.InitialValue, LSequence.Increment])) + ';'; // <-- if i add this all work ok
Result := Result + ' END;';
end;
1 - first time (no sequence in database): i create this sequence manualy and i get others error :
585928170887 14:01:11.639 8604 TFDPhysOracleCommand TFDQuery($05CC71D0) >> Execute [Command="BEGIN EXECUTE IMMEDIATE 'DROP SEQUENCE "SEQ_PUB_SUBCPTION" '; EXECUTE IMMEDIATE 'CREATE SEQUENCE "SEQ_PUB_SUBCPTION" MINVALUE 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 1 CACHE 20 NOORDER NOCYCLE' END; ", ATimes=0, AOffset=0] 585928170914 14:01:11.639 8604 TFDPhysOracleCommand TFDQuery($05CC71D0) . OCIStmtExecute [ARows=1, AOffset=0, AExact=False, ACommit=False] 585928182170 14:01:11.643 8604 <nil> . ORA-06550: Ligne 1, colonne 221 : PLS-00103: Symbole "END" rencontré à la place d'un des symboles suivants :
- & = - + ; < / > at in is mod remainder not rem return returning <exposant (**)> <> or != or ~= >= <= <> and or like like2 like4 likec b [Lvl=1, ErrCode=6550]
2- If i add + ';' in the end of second command (Result := Result + ..) all work ok
Comments (11)
-
repo owner -
- changed status to resolved
→ <<cset 2d53badfe54e>>
-
repo owner - changed status to closed
-
hello, not work because char ';' is not in the correct way see :
function TOracleSQLGenerator.GenerateCreateSequence( const command: TCreateSequenceCommand): string; var LSequence: SequenceAttribute; begin LSequence := command.Sequence; Result := 'BEGIN '; if command.SequenceExists then Result := Result + 'EXECUTE IMMEDIATE ' + QuotedStr(Format('DROP SEQUENCE "%0:S;" ', [LSequence.SequenceName])); //AL 18/02/2015 // Result := Result + ' EXECUTE IMMEDIATE ' + QuotedStr(Format('CREATE SEQUENCE "%0:S" MINVALUE 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY %2:D START WITH %1:D CACHE 20 NOORDER NOCYCLE', // [LSequence.SequenceName, LSequence.InitialValue, LSequence.Increment])); Result := Result + ' EXECUTE IMMEDIATE ' + QuotedStr(Format('CREATE SEQUENCE "%0:S" MINVALUE 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY %2:D START WITH %1:D CACHE 20 NOORDER NOCYCLE;', [LSequence.SequenceName, LSequence.InitialValue, LSequence.Increment])) '; Result := Result + ' END;'; end;
my modif
function TOracleSQLGenerator.GenerateCreateSequence( const command: TCreateSequenceCommand): string; var LSequence: SequenceAttribute; begin LSequence := command.Sequence; Result := 'BEGIN '; if command.SequenceExists then Result := Result + 'EXECUTE IMMEDIATE ' + QuotedStr(Format('DROP SEQUENCE "%0:S" ', [LSequence.SequenceName])) + ';'; //AL 18/02/2015 // Result := Result + ' EXECUTE IMMEDIATE ' + QuotedStr(Format('CREATE SEQUENCE "%0:S" MINVALUE 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY %2:D START WITH %1:D CACHE 20 NOORDER NOCYCLE', // [LSequence.SequenceName, LSequence.InitialValue, LSequence.Increment])); Result := Result + ' EXECUTE IMMEDIATE ' + QuotedStr(Format('CREATE SEQUENCE "%0:S" MINVALUE 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY %2:D START WITH %1:D CACHE 20 NOORDER NOCYCLE', [LSequence.SequenceName, LSequence.InitialValue, LSequence.Increment])) + ';'; // <-- if i add this all work ok Result := Result + ' END;'; end;
Best Regards
-
Oops, sorry, missed that it uses QuotedStr here...Will fix it asap.
-
repo owner - changed status to open
-
repo owner - marked as minor
-
assigned issue to
-
repo owner - changed component to Persistence
- changed milestone to 1.2
-
- changed status to resolved
fixes
#84→ <<cset 5c8d7f0564ab>>
-
repo owner - changed milestone to 1.2 (next version)
-
repo owner - changed milestone to 1.2
- Log in to comment
Duplicate of
#83.