-- B1 DEPENDS: AFTER:SP:_TmSp_BootCreateGlobalTempTables2 AFTER:PT:PROCESS_END AFTER:SP:_TmSp_ValidateSpParam

CREATE PROCEDURE CRSP_BPRANGE
(
	execSQL NCLOB
)
LANGUAGE SQLSCRIPT 
SQL SECURITY INVOKER
AS
BEGIN
	call _TmSp_ValidateSpParam(execSQL);
	
	DELETE FROM CRSP_TEMP_BPRANGE;
	exec ('INSERT INTO CRSP_TEMP_BPRANGE SELECT MIN("CardCode"), MAX("CardCode") FROM (SELECT "CardCode" FROM OCRD T0 WHERE ' || :execSQL || ')');
	SELECT MINCODE, MAXCODE FROM CRSP_TEMP_BPRANGE;
END