Du kan ikke bruge sekvenser i forespørgsler med ORDER BY
.
Fjern ORDER BY
eller indsæt i en underforespørgsel:
SELECT q.*, customer_id_seq.nextval
FROM (
SELECT c.cust_name,
c.site
FROM customer c
WHERE c.customer_id IS NULL
ORDER BY
c.site_code ASC
) q