Hello, I'm trying to compile a query to perform an insert, as it uses only database data I'm a select for this. My problem is in the where clause where either end of operation has to be null or the year of the end of operation has to be shorter than period, more precisely the problem is in the STRCMP function.
INSERT INTO EMPRESAS_FILIAL(IDPERIODO, IDEMPRESA, IDFILIAL)
select ".{IDPERIODO}.", IDEMPRESAS emp, COD_PLANTA fi
FROM EMPRESAS emp, FILIAL fi, PERIODO pe
WHERE (emp.ASSOCIADO = '1'
AND fi.ATUACAORESPONSAVEL = '1' AND fi.ECONOMICO ='1'
AND emp.IDEMPRESAS = fi.EMPRESAS_IDEMPRESAS)
AND pe.IDPERIODO = ".{IDPERIODO}."
AND ( fi.FIMOPERACAO = NULL OR STRCMP(pe.PERIODO, (to_char(fi.FIMOPERACAO, 'YYYY'))) = 1);
Attempt to run is generating this error: SQL Error: ORA-00904: "STRCMP": Invalid identifier 00904. 00000 - "% s: invalid identifier"
pe.PERIODO - VARCHAR2
fi.FIMOPERACAO - DATE