Function error

From: Sachin Srivastava <ssr(dot)teleatlas(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Function error
Date: 2016-01-08 07:24:24
Message-ID: CAFzqEhK5Kj2df01PR7537sFt_PspjkTN0akz9wujqa0H1Uf_gA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Dear Concern,

I am creating below function *“create_catexp_ss_master()” *and getting
error as below, I have already created dependent function firstly
successfully *(“create_catexp_ss_1” and “create_catexp_ss_2”) *but still
getting error, please suggest why?

ERROR: syntax error at or near "create_catexp_ss_1"

LINE 38: create_catexp_ss_1;

^

********** Error **********

ERROR: syntax error at or near "create_catexp_ss_1"

SQL state: 42601

Character: 1104

-- Function: create_catexp_ss_master()

-- DROP FUNCTION create_catexp_ss_master();

CREATE OR REPLACE FUNCTION create_catexp_ss_master()

RETURNS void AS

$BODY$

DECLARE

-- Build snapshot tables for catalog itme exposure.

-- Versions:

-- 2013.1 hxu T11464 - Two Table Catalog Snap Shot Process. 02/27/13

-- 2013.02 hxu T11899 - Remove the Single Supplier check box from Screen
and from the Code. 05/23/13

--

v_count_before bigint;

v_count_after bigint;

v_start_time timestamp;

v_err_msg varchar(1000);

v_set_name varchar(10);

BEGIN

v_set_name:=ssj4_snapshot_pkg.get_inactive_ss_set_name;

SELECT LOCALTIMESTAMP INTO v_start_time ;

if v_set_name='A' then

SELECT count(1) INTO v_count_before FROM
pcat_exp_supp_buyer_ss_a;

else

SELECT count(1) INTO v_count_before FROM
pcat_exp_supp_buyer_ss_b;

end if;

-- Remove old data.

EXECUTE 'truncate table
pcat_exp_supp_buyer_ss_'||v_set_name;

EXECUTE 'truncate table
pcat_exp_supp_cat_buyer_ss_'||v_set_name;

-- Exposure for single supplier without category
filtering

create_catexp_ss_1;

-- Exposure for single supplier with category filtering

create_catexp_ss_2;

if v_set_name='A' then

SELECT count(1) INTO v_count_after FROM
pcat_exp_supp_buyer_ss_a;

else

SELECT count(1) INTO v_count_after FROM
pcat_exp_supp_buyer_ss_b;

end if;

-- Log

create_ss_log('Catalog Exposure', v_start_time,
'pcat_exp_supp_buyer_ss_'||v_set_name,

v_count_before, v_count_after, null);

exception -- log error

when others then

v_err_msg := SQLERRM;

create_ss_log('Catalog Exposure - Error', v_start_time,
'pcat_exp_supp_buyer_ss_'||v_set_name,

v_count_before,
v_count_after, v_err_msg);

END;

$BODY$

LANGUAGE plpgsql VOLATILE SECURITY DEFINER

COST 100;

ALTER FUNCTION create_catexp_ss_master()

OWNER TO postgres;

Regards,
SS

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Pavel Stehule 2016-01-08 07:35:33 Re: Function error
Previous Message Ben Chobot 2016-01-08 06:49:22 Re: RAM of Postgres Server