SHARE
TWEET

Untitled

a guest Jan 24th, 2020 73 in 6 hours
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --Maximo numero
  2. ------------------------------------------
  3. select cen_ope, MIN(nro_ope) nro
  4. from fcaptacab where cod_emp = 1 and cod_ope = 'Pta3'-- and cen_ope = 105--
  5. and nro_ope >= 60000000
  6. --order by nro_ope
  7. group by cen_ope
  8.  
  9.  
  10. --Numeracion - busqueda de huecos
  11. ----
  12. set transaction isolation level read uncommitted
  13. select
  14. (select x.nro_ope-a.nro_ope from fcaptacab x where 1=1
  15. and x.cod_emp=a.cod_emp
  16. and x.cod_ope=a.cod_ope
  17. and x.cen_ope=a.cen_ope
  18. and x.nro_ope=(select min(z.nro_ope) from fcaptacab z where 1=1
  19.     and z.cod_emp=x.cod_emp
  20.     and z.cod_ope=x.cod_ope
  21.     and z.cen_ope=x.cen_ope
  22.     and z.nro_ope>a.nro_ope
  23.     )
  24. ),
  25. *
  26. from fcaptacab a
  27. where  1=1
  28. and not exists(select 1 from fcaptacab x where 1=1
  29.     and a.cod_emp=x.cod_emp
  30.     and a.cod_ope=x.cod_ope
  31.     and a.cen_ope=x.cen_ope
  32.     and a.nro_ope+1=x.nro_ope
  33.     )
  34. --and a.nro_ope=b.nro_ope
  35. and a.cod_emp = 1
  36. and a.cod_ope = 'Pta3'
  37. and a.cen_ope=105
  38. --and a.nro_ope =55150930
  39. order by 1 desc
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top