0
I need to generate an excel of a table data but I need to do for each my company, so n have to run select changing the company id I thought to do with Procedure but the ones I have and just update and Insert I thought the logic would be the same but not this flowing. Bs do not need to pass parameter.
DECLARE
v_nome_empresa VARCHAR2(50);
CURSOR v_empresas IS SELECT * FROM cf_empresa emp WHERE emp.ID_ADMINISTRACAO = 298;
BEGIN
FOR v_empresa IN v_empresas LOOP
SELECT emp.RAZAO_SOCIAL
INTO v_nome_empresa
from EST_PRODUTO_ESTOQUE prodEstoque
inner join EST_PRODUTO produto on prodEstoque.ID_PRODUTO = produto.ID_PRODUTO
inner join EST_FORNECEDOR forn on produto.ID_FORNECEDOR = forn.ID_FORNECEDOR
inner join CF_EMPRESA emp on prodEstoque.ID_EMPRESA = emp.ID_EMPRESA
where forn.ID_FORNECEDOR = 99205390 or forn.ID_FORNECEDOR = 106534020 AND v_empresa.ID_EMPRESA = emp.ID_EMPRESA
dbms_output.put_line('Nome empresa '|| v_nome_empresa);
END LOOP;
END;
returned error :
Relatório de erros -
ORA-06550: linha 19, coluna 2:
PL/SQL: ORA-00933: comando SQL não encerrado adequadamente
ORA-06550: linha 11, coluna 5:
PL/SQL: SQL Statement ignored
06550. 00000 - "line %s, column %s:\n%s"
*Cause: Usually a PL/SQL compilation error.
*Action:
What a way I can do that?
Seems to be missing a ';' at the end of SELECT INTO.
– bruno
n was that Bruno
– Guilherme Oliveira
Doesn’t say anything else about the error? Doesn’t point a line or anything, or even an error code?
– bruno101
this on the new Edit
– Guilherme Oliveira
@Guilhermeoliveira the select needs to be inside a block
BEGIN
END
I believe that caused the error– JMSlasher