sql >> Database teknologi >  >> RDS >> Oracle

script til manglende tal virker ikke?

Se dette eksempel

WITH ORDH AS (SELECT 1111 AS ORDERNO FROM DUAL UNION ALL SELECT 1112 AS ORDERNO FROM DUAL UNION ALL SELECT 1115 AS ORDERNO FROM DUAL UNION ALL SELECT 1116 AS ORDERNO FROM DUAL UNION ALL SELECT 1118 AS ORDERNO FROM DUAL UNION ALL SELECT 1121 AS ORDERNO FROM DUAL), GOT_NEXT_ORDERNO AS (SELECT ORDERNO, LEAD ( ORDERNO ) OVER (ORDER BY ORDERNO) AS NEXT_ORDERNO FROM ORDH) SELECT ORDERNO + 1 AS FROM_NO, NEXT_ORDERNO - 1 AS TO_NO FROM GOT_NEXT_ORDERNO WHERE ORDERNO + 1 <> NEXT_ORDERNO; FROM_NO TO_NO ---------- ---------- 1113 1114 1117 1117 1119 1120 3 rows selected.


  1. Simpel SELECT med variabel men uden INTO

  2. mysql tæller hvor mange gange et felt linker til et andet

  3. Indlæser flere elementer fra databasen ~ Infinite Scroll

  4. Laravel ændrer databaseparametre under kørsel