pls-00642 local collection types not allowed in sql statementHow can I prevent SQL injection in PHP?How do I perform an IF…THEN in an SQL SELECT?Add a column with a default value to an existing table in SQL ServerHow to return only the Date from a SQL Server DateTime datatypeInserting multiple rows in a single SQL query?How can I do an UPDATE statement with JOIN in SQL?How do I UPDATE from a SELECT in SQL Server?Finding duplicate values in a SQL tableWhat are the options for storing hierarchical data in a relational database?How do I import an SQL file using the command line in MySQL?
If my business card says 〇〇さん, does that mean I'm referring to myself with an honourific?
Other than a swing wing, what types of variable geometry have flown?
Why are off grid solar setups only 12, 24, 48 VDC?
Memory capability and powers of 2
kids pooling money for Lego League and taxes
Keeping an "hot eyeball planet" wet
The seven story archetypes. Are they truly all of them?
How can I tell if there was a power cut while I was out?
What exactly makes a General Products hull nearly indestructible?
401(k) investment after being fired. Do I own it?
Are glider winch launches rarer in the USA than in the rest of the world? Why?
Would it be a good idea to memorize relative interval positions on guitar?
how to add 1 milliseconds on a datetime string?
What are the exact meanings of roll, pitch and yaw?
Who has jurisdiction for a crime committed in an embassy?
Very basic singly linked list
Character Frequency in a String
Extrapolation v. Interpolation
How do professional electronic musicians/sound engineers combat listening fatigue?
What should I say when a company asks you why someone (a friend) who was fired left?
How do I run a game when my PCs have different approaches to combat?
Does static fire reduce reliability?
Why did Saturn V not head straight to the moon?
What is the meaning of "a thinly disguised price"?
pls-00642 local collection types not allowed in sql statement
How can I prevent SQL injection in PHP?How do I perform an IF…THEN in an SQL SELECT?Add a column with a default value to an existing table in SQL ServerHow to return only the Date from a SQL Server DateTime datatypeInserting multiple rows in a single SQL query?How can I do an UPDATE statement with JOIN in SQL?How do I UPDATE from a SELECT in SQL Server?Finding duplicate values in a SQL tableWhat are the options for storing hierarchical data in a relational database?How do I import an SQL file using the command line in MySQL?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I understand that exists a lot of material about this, but I still cannot make this work properly. The code above is my last attempt. The problem is I have duplicate and sometimes triplicate records in a table
What I need:
- get repeated records
- "save" the minor sequencial of each repeated record (first to be created, should be maintained)
- delete other records
*I could not make group by... having count > 1 using sequential, cause sequentials do not repeat
DECLARE
TYPE SEQ_HISTORICO IS TABLE OF SIA.HISTORICO_ESCOLAR.NUM_SEQ_HISTORICO%TYPE;
V_MANTER SEQ_HISTORICO; -- least sequential, should be mantained
V_EXCLUIR SEQ_HISTORICO; -- others, to be deleted
BEGIN
WITH
DUPLICADAS AS
(
select he.seq_historico,
he.cod_disciplina,
di.nom_disciplina,
pa.nom_fantasia,
he.cod_situacao_aluno_turma
from ow.historico_escolar he
inner join ow.periodo_academico pa on he.num_seq_periodo_academico =
pa.num_seq_periodo_academico
inner join ow.disciplina di on he.cod_disciplina = di.cod_disciplina
where he.seq_aluno_curso = '424242'
and he.cod_situacao_aluno_turma = 'IS'
)
SELECT LEAST(nseq_historico) INTO V_MANTER FROM DUPLICADAS;
END;
ERROR: pls-00642 local collection types not allowed in sql statement
Should I use pls_integer?
sql oracle plsql
add a comment |
I understand that exists a lot of material about this, but I still cannot make this work properly. The code above is my last attempt. The problem is I have duplicate and sometimes triplicate records in a table
What I need:
- get repeated records
- "save" the minor sequencial of each repeated record (first to be created, should be maintained)
- delete other records
*I could not make group by... having count > 1 using sequential, cause sequentials do not repeat
DECLARE
TYPE SEQ_HISTORICO IS TABLE OF SIA.HISTORICO_ESCOLAR.NUM_SEQ_HISTORICO%TYPE;
V_MANTER SEQ_HISTORICO; -- least sequential, should be mantained
V_EXCLUIR SEQ_HISTORICO; -- others, to be deleted
BEGIN
WITH
DUPLICADAS AS
(
select he.seq_historico,
he.cod_disciplina,
di.nom_disciplina,
pa.nom_fantasia,
he.cod_situacao_aluno_turma
from ow.historico_escolar he
inner join ow.periodo_academico pa on he.num_seq_periodo_academico =
pa.num_seq_periodo_academico
inner join ow.disciplina di on he.cod_disciplina = di.cod_disciplina
where he.seq_aluno_curso = '424242'
and he.cod_situacao_aluno_turma = 'IS'
)
SELECT LEAST(nseq_historico) INTO V_MANTER FROM DUPLICADAS;
END;
ERROR: pls-00642 local collection types not allowed in sql statement
Should I use pls_integer?
sql oracle plsql
1
You couldBULK COLLECT INTO V_MANTER
, but I'm not sure you meantLEAST()
- perhapsMIN()
; but then if you're only getting back a single value to keep you don't need a collection there. You seem to be identifying onenum_seq_aluno_curso
/cod_situacao_aluno_turma
paris at a time, at the moment anyway.... But are the duplicates in that table, or in the ones you're joining to - otherwise why join at all? And why are you using PL/SQL at all, instead of just directly deleting the duplicates?
– Alex Poole
Mar 26 at 16:29
is not a single value... is the min sequential for each group of repeated discipline
– tramada
Mar 26 at 16:30
Well, there will be a single min value for each group, but your query is only looking at one group - isn't it? Perhaps you hope to remove thewhere
clause later, but at the moment you'd still only get a single value from the query - assuming you did meanmin()
notleast()
, which doesn't tell you anything with a single argument; and it wouldn't necessarily relate to a duplicate. Maybe adding sample data and more about what you want to achieve would help point you to a different approach.
– Alex Poole
Mar 26 at 16:32
1
"is the min sequential for each group of repeated discipline" Then you need MIN() and a GROUP BY clause. It's hard for us to understand what you're trying to achieve by code alone. It would be helpful if you provided some sample input data and required outcome derived from that input.
– APC
Mar 26 at 16:33
ok, thank you, i'm working on this
– tramada
Mar 26 at 16:39
add a comment |
I understand that exists a lot of material about this, but I still cannot make this work properly. The code above is my last attempt. The problem is I have duplicate and sometimes triplicate records in a table
What I need:
- get repeated records
- "save" the minor sequencial of each repeated record (first to be created, should be maintained)
- delete other records
*I could not make group by... having count > 1 using sequential, cause sequentials do not repeat
DECLARE
TYPE SEQ_HISTORICO IS TABLE OF SIA.HISTORICO_ESCOLAR.NUM_SEQ_HISTORICO%TYPE;
V_MANTER SEQ_HISTORICO; -- least sequential, should be mantained
V_EXCLUIR SEQ_HISTORICO; -- others, to be deleted
BEGIN
WITH
DUPLICADAS AS
(
select he.seq_historico,
he.cod_disciplina,
di.nom_disciplina,
pa.nom_fantasia,
he.cod_situacao_aluno_turma
from ow.historico_escolar he
inner join ow.periodo_academico pa on he.num_seq_periodo_academico =
pa.num_seq_periodo_academico
inner join ow.disciplina di on he.cod_disciplina = di.cod_disciplina
where he.seq_aluno_curso = '424242'
and he.cod_situacao_aluno_turma = 'IS'
)
SELECT LEAST(nseq_historico) INTO V_MANTER FROM DUPLICADAS;
END;
ERROR: pls-00642 local collection types not allowed in sql statement
Should I use pls_integer?
sql oracle plsql
I understand that exists a lot of material about this, but I still cannot make this work properly. The code above is my last attempt. The problem is I have duplicate and sometimes triplicate records in a table
What I need:
- get repeated records
- "save" the minor sequencial of each repeated record (first to be created, should be maintained)
- delete other records
*I could not make group by... having count > 1 using sequential, cause sequentials do not repeat
DECLARE
TYPE SEQ_HISTORICO IS TABLE OF SIA.HISTORICO_ESCOLAR.NUM_SEQ_HISTORICO%TYPE;
V_MANTER SEQ_HISTORICO; -- least sequential, should be mantained
V_EXCLUIR SEQ_HISTORICO; -- others, to be deleted
BEGIN
WITH
DUPLICADAS AS
(
select he.seq_historico,
he.cod_disciplina,
di.nom_disciplina,
pa.nom_fantasia,
he.cod_situacao_aluno_turma
from ow.historico_escolar he
inner join ow.periodo_academico pa on he.num_seq_periodo_academico =
pa.num_seq_periodo_academico
inner join ow.disciplina di on he.cod_disciplina = di.cod_disciplina
where he.seq_aluno_curso = '424242'
and he.cod_situacao_aluno_turma = 'IS'
)
SELECT LEAST(nseq_historico) INTO V_MANTER FROM DUPLICADAS;
END;
ERROR: pls-00642 local collection types not allowed in sql statement
Should I use pls_integer?
sql oracle plsql
sql oracle plsql
edited Mar 26 at 16:29
tramada
asked Mar 26 at 16:12
tramadatramada
3595 silver badges16 bronze badges
3595 silver badges16 bronze badges
1
You couldBULK COLLECT INTO V_MANTER
, but I'm not sure you meantLEAST()
- perhapsMIN()
; but then if you're only getting back a single value to keep you don't need a collection there. You seem to be identifying onenum_seq_aluno_curso
/cod_situacao_aluno_turma
paris at a time, at the moment anyway.... But are the duplicates in that table, or in the ones you're joining to - otherwise why join at all? And why are you using PL/SQL at all, instead of just directly deleting the duplicates?
– Alex Poole
Mar 26 at 16:29
is not a single value... is the min sequential for each group of repeated discipline
– tramada
Mar 26 at 16:30
Well, there will be a single min value for each group, but your query is only looking at one group - isn't it? Perhaps you hope to remove thewhere
clause later, but at the moment you'd still only get a single value from the query - assuming you did meanmin()
notleast()
, which doesn't tell you anything with a single argument; and it wouldn't necessarily relate to a duplicate. Maybe adding sample data and more about what you want to achieve would help point you to a different approach.
– Alex Poole
Mar 26 at 16:32
1
"is the min sequential for each group of repeated discipline" Then you need MIN() and a GROUP BY clause. It's hard for us to understand what you're trying to achieve by code alone. It would be helpful if you provided some sample input data and required outcome derived from that input.
– APC
Mar 26 at 16:33
ok, thank you, i'm working on this
– tramada
Mar 26 at 16:39
add a comment |
1
You couldBULK COLLECT INTO V_MANTER
, but I'm not sure you meantLEAST()
- perhapsMIN()
; but then if you're only getting back a single value to keep you don't need a collection there. You seem to be identifying onenum_seq_aluno_curso
/cod_situacao_aluno_turma
paris at a time, at the moment anyway.... But are the duplicates in that table, or in the ones you're joining to - otherwise why join at all? And why are you using PL/SQL at all, instead of just directly deleting the duplicates?
– Alex Poole
Mar 26 at 16:29
is not a single value... is the min sequential for each group of repeated discipline
– tramada
Mar 26 at 16:30
Well, there will be a single min value for each group, but your query is only looking at one group - isn't it? Perhaps you hope to remove thewhere
clause later, but at the moment you'd still only get a single value from the query - assuming you did meanmin()
notleast()
, which doesn't tell you anything with a single argument; and it wouldn't necessarily relate to a duplicate. Maybe adding sample data and more about what you want to achieve would help point you to a different approach.
– Alex Poole
Mar 26 at 16:32
1
"is the min sequential for each group of repeated discipline" Then you need MIN() and a GROUP BY clause. It's hard for us to understand what you're trying to achieve by code alone. It would be helpful if you provided some sample input data and required outcome derived from that input.
– APC
Mar 26 at 16:33
ok, thank you, i'm working on this
– tramada
Mar 26 at 16:39
1
1
You could
BULK COLLECT INTO V_MANTER
, but I'm not sure you meant LEAST()
- perhaps MIN()
; but then if you're only getting back a single value to keep you don't need a collection there. You seem to be identifying one num_seq_aluno_curso
/cod_situacao_aluno_turma
paris at a time, at the moment anyway.... But are the duplicates in that table, or in the ones you're joining to - otherwise why join at all? And why are you using PL/SQL at all, instead of just directly deleting the duplicates?– Alex Poole
Mar 26 at 16:29
You could
BULK COLLECT INTO V_MANTER
, but I'm not sure you meant LEAST()
- perhaps MIN()
; but then if you're only getting back a single value to keep you don't need a collection there. You seem to be identifying one num_seq_aluno_curso
/cod_situacao_aluno_turma
paris at a time, at the moment anyway.... But are the duplicates in that table, or in the ones you're joining to - otherwise why join at all? And why are you using PL/SQL at all, instead of just directly deleting the duplicates?– Alex Poole
Mar 26 at 16:29
is not a single value... is the min sequential for each group of repeated discipline
– tramada
Mar 26 at 16:30
is not a single value... is the min sequential for each group of repeated discipline
– tramada
Mar 26 at 16:30
Well, there will be a single min value for each group, but your query is only looking at one group - isn't it? Perhaps you hope to remove the
where
clause later, but at the moment you'd still only get a single value from the query - assuming you did mean min()
not least()
, which doesn't tell you anything with a single argument; and it wouldn't necessarily relate to a duplicate. Maybe adding sample data and more about what you want to achieve would help point you to a different approach.– Alex Poole
Mar 26 at 16:32
Well, there will be a single min value for each group, but your query is only looking at one group - isn't it? Perhaps you hope to remove the
where
clause later, but at the moment you'd still only get a single value from the query - assuming you did mean min()
not least()
, which doesn't tell you anything with a single argument; and it wouldn't necessarily relate to a duplicate. Maybe adding sample data and more about what you want to achieve would help point you to a different approach.– Alex Poole
Mar 26 at 16:32
1
1
"is the min sequential for each group of repeated discipline" Then you need MIN() and a GROUP BY clause. It's hard for us to understand what you're trying to achieve by code alone. It would be helpful if you provided some sample input data and required outcome derived from that input.
– APC
Mar 26 at 16:33
"is the min sequential for each group of repeated discipline" Then you need MIN() and a GROUP BY clause. It's hard for us to understand what you're trying to achieve by code alone. It would be helpful if you provided some sample input data and required outcome derived from that input.
– APC
Mar 26 at 16:33
ok, thank you, i'm working on this
– tramada
Mar 26 at 16:39
ok, thank you, i'm working on this
– tramada
Mar 26 at 16:39
add a comment |
1 Answer
1
active
oldest
votes
The error is trying to tell you that you can't SELECT...INTO...
an instance of a type declared in PL/SQL. In this case the problem arises because of
SELECT LEAST(nseq_historico) INTO V_MANTER FROM DUPLICADAS
Here, V_MANTER
is of type SEQ_HISTORICO
which is defined in a PL/SQL block.
You can, however, BULK COLLECT
into a PL/SQL collection, but in order to use the MIN
function you'll need to add a GROUP BY clause. It appears from your comments that you want to group by HISTORICO_ESCOLAR.COD_DISCIPLINA, so putting this together we get:
WITH DUPLICADAS AS (select he.seq_historico,
he.cod_disciplina,
di.nom_disciplina,
pa.nom_fantasia,
he.cod_situacao_aluno_turma
from ow.historico_escolar he
inner join ow.periodo_academico pa
on he.num_seq_periodo_academico = pa.num_seq_periodo_academico
inner join ow.disciplina di
on he.cod_disciplina = di.cod_disciplina
where he.seq_aluno_curso = '424242' and
he.cod_situacao_aluno_turma = 'IS')
SELECT COD_DISCIPLINA, MIN(SEQ_HISTORICO)
BULK COLLECT INTO V_MANTER
FROM DUPLICADAS
GROUP BY COD_DISCIPLINA
Best of luck.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55361666%2fpls-00642-local-collection-types-not-allowed-in-sql-statement%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
The error is trying to tell you that you can't SELECT...INTO...
an instance of a type declared in PL/SQL. In this case the problem arises because of
SELECT LEAST(nseq_historico) INTO V_MANTER FROM DUPLICADAS
Here, V_MANTER
is of type SEQ_HISTORICO
which is defined in a PL/SQL block.
You can, however, BULK COLLECT
into a PL/SQL collection, but in order to use the MIN
function you'll need to add a GROUP BY clause. It appears from your comments that you want to group by HISTORICO_ESCOLAR.COD_DISCIPLINA, so putting this together we get:
WITH DUPLICADAS AS (select he.seq_historico,
he.cod_disciplina,
di.nom_disciplina,
pa.nom_fantasia,
he.cod_situacao_aluno_turma
from ow.historico_escolar he
inner join ow.periodo_academico pa
on he.num_seq_periodo_academico = pa.num_seq_periodo_academico
inner join ow.disciplina di
on he.cod_disciplina = di.cod_disciplina
where he.seq_aluno_curso = '424242' and
he.cod_situacao_aluno_turma = 'IS')
SELECT COD_DISCIPLINA, MIN(SEQ_HISTORICO)
BULK COLLECT INTO V_MANTER
FROM DUPLICADAS
GROUP BY COD_DISCIPLINA
Best of luck.
add a comment |
The error is trying to tell you that you can't SELECT...INTO...
an instance of a type declared in PL/SQL. In this case the problem arises because of
SELECT LEAST(nseq_historico) INTO V_MANTER FROM DUPLICADAS
Here, V_MANTER
is of type SEQ_HISTORICO
which is defined in a PL/SQL block.
You can, however, BULK COLLECT
into a PL/SQL collection, but in order to use the MIN
function you'll need to add a GROUP BY clause. It appears from your comments that you want to group by HISTORICO_ESCOLAR.COD_DISCIPLINA, so putting this together we get:
WITH DUPLICADAS AS (select he.seq_historico,
he.cod_disciplina,
di.nom_disciplina,
pa.nom_fantasia,
he.cod_situacao_aluno_turma
from ow.historico_escolar he
inner join ow.periodo_academico pa
on he.num_seq_periodo_academico = pa.num_seq_periodo_academico
inner join ow.disciplina di
on he.cod_disciplina = di.cod_disciplina
where he.seq_aluno_curso = '424242' and
he.cod_situacao_aluno_turma = 'IS')
SELECT COD_DISCIPLINA, MIN(SEQ_HISTORICO)
BULK COLLECT INTO V_MANTER
FROM DUPLICADAS
GROUP BY COD_DISCIPLINA
Best of luck.
add a comment |
The error is trying to tell you that you can't SELECT...INTO...
an instance of a type declared in PL/SQL. In this case the problem arises because of
SELECT LEAST(nseq_historico) INTO V_MANTER FROM DUPLICADAS
Here, V_MANTER
is of type SEQ_HISTORICO
which is defined in a PL/SQL block.
You can, however, BULK COLLECT
into a PL/SQL collection, but in order to use the MIN
function you'll need to add a GROUP BY clause. It appears from your comments that you want to group by HISTORICO_ESCOLAR.COD_DISCIPLINA, so putting this together we get:
WITH DUPLICADAS AS (select he.seq_historico,
he.cod_disciplina,
di.nom_disciplina,
pa.nom_fantasia,
he.cod_situacao_aluno_turma
from ow.historico_escolar he
inner join ow.periodo_academico pa
on he.num_seq_periodo_academico = pa.num_seq_periodo_academico
inner join ow.disciplina di
on he.cod_disciplina = di.cod_disciplina
where he.seq_aluno_curso = '424242' and
he.cod_situacao_aluno_turma = 'IS')
SELECT COD_DISCIPLINA, MIN(SEQ_HISTORICO)
BULK COLLECT INTO V_MANTER
FROM DUPLICADAS
GROUP BY COD_DISCIPLINA
Best of luck.
The error is trying to tell you that you can't SELECT...INTO...
an instance of a type declared in PL/SQL. In this case the problem arises because of
SELECT LEAST(nseq_historico) INTO V_MANTER FROM DUPLICADAS
Here, V_MANTER
is of type SEQ_HISTORICO
which is defined in a PL/SQL block.
You can, however, BULK COLLECT
into a PL/SQL collection, but in order to use the MIN
function you'll need to add a GROUP BY clause. It appears from your comments that you want to group by HISTORICO_ESCOLAR.COD_DISCIPLINA, so putting this together we get:
WITH DUPLICADAS AS (select he.seq_historico,
he.cod_disciplina,
di.nom_disciplina,
pa.nom_fantasia,
he.cod_situacao_aluno_turma
from ow.historico_escolar he
inner join ow.periodo_academico pa
on he.num_seq_periodo_academico = pa.num_seq_periodo_academico
inner join ow.disciplina di
on he.cod_disciplina = di.cod_disciplina
where he.seq_aluno_curso = '424242' and
he.cod_situacao_aluno_turma = 'IS')
SELECT COD_DISCIPLINA, MIN(SEQ_HISTORICO)
BULK COLLECT INTO V_MANTER
FROM DUPLICADAS
GROUP BY COD_DISCIPLINA
Best of luck.
answered Mar 26 at 17:17
Bob JarvisBob Jarvis
36.7k5 gold badges62 silver badges89 bronze badges
36.7k5 gold badges62 silver badges89 bronze badges
add a comment |
add a comment |
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55361666%2fpls-00642-local-collection-types-not-allowed-in-sql-statement%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
You could
BULK COLLECT INTO V_MANTER
, but I'm not sure you meantLEAST()
- perhapsMIN()
; but then if you're only getting back a single value to keep you don't need a collection there. You seem to be identifying onenum_seq_aluno_curso
/cod_situacao_aluno_turma
paris at a time, at the moment anyway.... But are the duplicates in that table, or in the ones you're joining to - otherwise why join at all? And why are you using PL/SQL at all, instead of just directly deleting the duplicates?– Alex Poole
Mar 26 at 16:29
is not a single value... is the min sequential for each group of repeated discipline
– tramada
Mar 26 at 16:30
Well, there will be a single min value for each group, but your query is only looking at one group - isn't it? Perhaps you hope to remove the
where
clause later, but at the moment you'd still only get a single value from the query - assuming you did meanmin()
notleast()
, which doesn't tell you anything with a single argument; and it wouldn't necessarily relate to a duplicate. Maybe adding sample data and more about what you want to achieve would help point you to a different approach.– Alex Poole
Mar 26 at 16:32
1
"is the min sequential for each group of repeated discipline" Then you need MIN() and a GROUP BY clause. It's hard for us to understand what you're trying to achieve by code alone. It would be helpful if you provided some sample input data and required outcome derived from that input.
– APC
Mar 26 at 16:33
ok, thank you, i'm working on this
– tramada
Mar 26 at 16:39