-
-
Save garymanley/80e4bd4f890e68054a0d35a90208d5dd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create or replace procedure p_run_control(p_csl_id number) returns number | |
language sql as | |
declare | |
v_sql varchar2(2000); | |
v_year_month number(6); | |
begin | |
select period into v_year_month from KEBOOLA_7127.WORKSPACE_15661914.CURRENT_PERIOD cp ; | |
select sql_text into v_sql from KEBOOLA_7127.WORKSPACE_15661914.ICE_CONTROL_SOURCE_LINK where csl_id = :p_csl_id; | |
v_sql := 'INSERT INTO KEBOOLA_7127.WORKSPACE_15661914.ICE_AMOUNT(year_month,csl_id,amount) select ' || v_year_month || ' , ' || p_csl_id || ' , amount FROM (' || v_sql || ' ) x ' ; | |
execute immediate v_sql; | |
exception | |
when other then insert into KEBOOLA_7127.WORKSPACE_15661914.ICE_CONTROL_ERROR(icsl_id, year_month) | |
values(:p_csl_id,:v_year_month) ; | |
end ; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment