Cursor c01 is
if :controle_empresarial.cd_produto is not null and
:controle_empresarial.cd_tipo_bem is not null and
:controle_empresarial.cd_carac_bem_segur is not null and
:controle_empresarial.cd_ramo is not null then
select xxxxxx
elsif xxxx then
select xxxxxxx
elsif xxxxxxxx then
end if;
porém não esta dando erro: dizendo que espera pelo select.
DECLARE
cSQL varchar2(1000);
TYPE RC IS REF CURSOR;
C1 RC;
cVarCol vachar2(100);
BEGIN
If <condicao1> then
cSQL := 'select dummy from dual';
Elsif <condicao2> then
cSQL := 'select coluna from Tabela';
end if;
OPEN C1 FOR cSQL;
LOOP
FETCH C1 into cVarCol;
EXIT WHEN C1%NOTFOUND;
Message(cVarCol);
END LOOP;
CLOSE C1;
END;
Bom, essa é a ideia ok
Pesquize tambem sobre:
- EXECUTE IMMEDIATE
- DBMS_SQL
- REF CURSOR
- Pacote EXEC_SQL do FORMS