Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Firebird e Interbase (https://www.clubdelphi.com/foros/forumdisplay.php?f=19)
-   -   funcion downto en firebird (https://www.clubdelphi.com/foros/showthread.php?t=95291)

IVAND 17-07-2021 01:08:59

funcion downto en firebird
 
Hola a todos

Hay alguna instruccion parecida a downto de delphi en firebird (stored procedure) para recorrer un campo de atras para adelante en un for
De antemano gracias

Ejemplo

for x=100 downto 1 do

mamcx 17-07-2021 02:13:17

En sql por regla general es un anti-patron él usar programación procedural. Qué es lo que quieres realmente hacer?

IVAND 17-07-2021 17:35:36

Gracias mamcx

Debo hacer un proceso para conocer un numero de validacion algo asi esta echo en delphi pero queria ponerlo en el store procedure

Código Delphi [-]
function TDataModule2.cadena11(ail: String): Integer;
Var
  x,largo,suma,total:Integer ;
  uma,weight:Integer ;
  cadena1:String ;
begin
    uma:=0;
    weight:=2;
    suma:=0;
    Largo:=Length(ail);
    for x:=Largo downto 1 do
     Begin
      cadena1:=copy(ail,x,1);
        suma:=suma+StrToInt(Cadena1) * weight ;
        weight:= weight+1 ;
        if weight > 7 Then
            weight:=2;
      End ;
    Total:= (11 - suma mod 11) ;

    if Total = 11 Then
        Result:=0
    Else
    If Total = 10 Then
         Result:=1
    else
         Result:=Total ;
end;

Casimiro Notevi 17-07-2021 20:44:33

Lo mismo te sirve un while
Código SQL [-]
i=10;
while i>0 do
  hacer lo que sea;
  i=i-1;
end while;

IVAND 17-07-2021 21:40:51

Muy amable voy a probar y les comento

IVAND 19-07-2021 16:21:18

Funciono perfecto gracias a todos por su tiempo


La franja horaria es GMT +2. Ahora son las 10:32:14.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi