Re: Function error

From: "Charles Clavadetscher" <clavadetscher(at)swisspug(dot)org>
To: "'Sachin Srivastava'" <ssr(dot)teleatlas(at)gmail(dot)com>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: Function error
Date: 2016-01-08 07:42:46
Message-ID: 002301d149e8$30617a30$91246e90$@swisspug.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello

If I understand you correctly you have two functions create_catexp_ss_1 and create_catexp_ss_2 that you then call from create_catexp_master.
If so then you probably need to change the call to them:

> -- Exposure for single supplier without category filtering
> create_catexp_ss_1;
>
> -- Exposure for single supplier with category filtering
> create_catexp_ss_2;

Should be:

PERFORM create_catexp_ss_1();
PERFORM create_catexp_ss_2();

If necessary with according parameters and assuming that you have no values returned that you need.

Bye
Charles

> -----Original Message-----
> From: pgsql-general-owner(at)postgresql(dot)org [mailto:pgsql-general-owner(at)postgresql(dot)org] On Behalf Of Sachin Srivastava
> Sent: Freitag, 8. Januar 2016 08:24
> To: pgsql-general(at)postgresql(dot)org
> Subject: [GENERAL] Function error
>
> 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
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Sachin Srivastava 2016-01-08 07:45:24 Re: Function error
Previous Message Meel Velliste 2016-01-08 07:37:45 Using xmax to detect deleted rows