drop function if exists fw_core.fn_jobctl_block_begin; CREATE OR REPLACE FUNCTION fw_core.fn_jobctl_block_begin(p_client_id int,p_function_id int,p_file_syspk int,p_block_table_name text,p_file_mnemonic text,p_file_sheet_mnemonic text,p_block_seq int) RETURNS void AS $$ begin /************************* select staging2.fn_jobctrl_block_begin(1,2,255,'block1','file','sheet',1) ***********************/ execute 'insert into fw_core.fw_jobctl_file_sheet_block_run_schedule (client_id,function_id,file_syspk,block_table_name,file_mnemonic,file_sheet_mnemonic,begin_status,block_table_load_seq,start_time) select '||p_client_id||', '||p_function_id||', '''||p_file_syspk||''','''||p_block_table_name||''','''||p_file_mnemonic||''','''||p_file_sheet_mnemonic||''',1,'||p_block_seq||',current_timestamp'; end $$ LANGUAGE plpgsql;