I'm facing a problem with two separate queries in oracle
. Both have the sql% share of%
The error that returns is REPLACE(dbms_lob.substr(wm_concat(disctinct <COLUNA>)), ',', ', ')
.
I looked for the error in ORA-22922: nonexistent LOB value
and SOPT
but none of the answers, or questions, gave me any light on the subject. Most of the questions are about errors in SOEN
, but my problem is in INSERT
.
Both queries have at least SELECT
.
The version used of LEFT OUTER JOIN
is oracle
.
When I run SQL in 11g
no error results, but when using the oracle database access library for C # the error occurs.
The SQL below is the one used by one of the queries:
SELECT *
FROM (SELECT ROWNUM NUM_REG, queryResult.*
FROM (
SELECT anp.id_klient "C",
anp.bruecke_1 "L",
anp.cod_conhec "Conhec",
anp.charge_ref "Ref. L",
anp.valor_cif "Valor CIF",
w.nr_doc "Documento",
w.datum_we "Dt. E",
SUM(q.mng_frei) "Qtd. D",
TRUNC(anp.datum_gera) "Dt. PC",
REPLACE(dbms_lob.substr(NVL(wm_concat(DISTINCT a8.nr_di),
empty_clob())),
',',
', ') "DI",
REPLACE(dbms_lob.substr(wm_concat(DISTINCT
TO_CHAR(a8.time_neu,
'dd/mm/yyyy'))),
',',
', ') "Dt. C DI",
REPLACE(dbms_lob.substr(NVL(wm_concat(DISTINCT a8.nr_da),
empty_clob())),
',',
', ') "DA",
REPLACE(dbms_lob.substr(NVL(wm_concat(DISTINCT ak.bez_1),
empty_clob())),
',',
', ') "Mercadoria",
REPLACE(dbms_lob.substr(NVL(wm_concat(DISTINCT
w.nr_zoll),
empty_clob())),
',',
', ') "CP",
REPLACE(dbms_lob.substr(NVL(wm_concat(DISTINCT w.laenge),
empty_clob())),
',',
', ') "T C",
REPLACE(dbms_lob.substr(NVL(wm_concat(DISTINCT
TO_CHAR(a4.time_out,
'dd/mm/yyyy')),
empty_clob())),
',',
', ') "Dt. S",
REPLACE(dbms_lob.substr(NVL(wm_concat(distinct
TO_CHAR(a4.time_end_unload,
'dd/mm/yyyy')),
empty_clob())),
',',
', ') "Dt. D"
FROM wms.quanten q
INNER JOIN wms.we w
ON (w.lager = q.lager AND
w.nr_lieferschein = REPLACE(q.charge, 'AG', 'AD') AND
w.nr_zoll = TRIM(q.trenn_3))
INNER JOIN wms.anliefpos anp
ON (anp.lager = q.lager AND anp.id_klient = q.id_klient AND
anp.bruecke_1 = REPLACE(q.charge, 'AG', 'AD'))
INNER JOIN wms.artikel ak
ON (ak.id_artikel = q.id_artikel)
LEFT OUTER JOIN wms.desmembr a8
ON (a8.lager = anp.lager AND a8.id_klient = anp.id_klient AND
a8.lote_ad = anp.bruecke_1 AND
a8.typ_process = 'DINACI')
LEFT OUTER JOIN wms.contcontrol a4
ON (a4.nr_container = w.nr_zoll AND a4.document = w.nr_doc AND
a4.lager = w.lager AND a4.stat = 90 AND
a4.stat_oc = 00)
WHERE q.lager = :estabelecimento
AND q.id_klient = :cliente HAVING SUM(q.mng_frei) > 0
GROUP BY anp.bruecke_1,
anp.cod_conhec,
anp.charge_ref,
anp.valor_cif,
w.nr_doc,
w.datum_we,
anp.id_klient,
anp.lager,
anp.datum_gera
ORDER BY anp.bruecke_1
) queryResult)
WHERE NUM_REG > :limiteInferior
AND NUM_REG <= :limiteSuperior
I would like to know the reason why an exception is raised and how I could treat it.
Editing
Home
I was able to find out that removing the PL/SQL
responsible for paging the query results as expected. However, I need the pagination for an eventual query that returns many records.
Initially my limits are respectively lower and higher, 0 and 35.
The query results in a total of 72 results, generating 3 pages.