Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8700977
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T02:17:28+00:00 2026-06-13T02:17:28+00:00

I have wrote following trigger. CREATE OR REPLACE FUNCTION tbl_scdr_insert_trigger() RETURNS TRIGGER AS $$

  • 0

I have wrote following trigger.

CREATE OR REPLACE FUNCTION tbl_scdr_insert_trigger() RETURNS TRIGGER AS $$
<< fk >>
DECLARE
    rowcount int;
    myrec RECORD;
BEGIN
    EXECUTE 'UPDATE sc_'|| to_char(NEW.start_datetime, 'YYYY_MM') ||' SET a = a + ($1).a, b = b + ($1).b WHERE (e_id = ($1).e_id AND start_datetime = ($1).start_datetime AND c_id = ($1).c_id'
    USING NEW;
    GET DIAGNOSTICS rowcount = ROW_COUNT;
    RAISE NOTICE 'found %', rowcount;
    IF not found THEN
        RAISE NOTICE 'not found';
    ELSIF found THEN
        RAISE NOTICE 'found';
        RETURN NULL;
    END IF;
END;
$$
LANGUAGE plpgsql;

When Ever Called this always return Zero as Rowcount because statement is not committed Yet and Found is always False even there are records with same values of where clause columns.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T02:17:29+00:00Added an answer on June 13, 2026 at 2:17 am

    As the PostgreSQL documentation states:

    EXECUTE changes the output of GET DIAGNOSTICS, but does not change FOUND

    That means that FOUND will always be FALSE in your case, because you are using EXECUTE and not a static UPDATE statement.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following table: CREATE TABLE FE_USER ( userid int identity (321,4) CONSTRAINT
I wrote the following loop since I have to repeat the same/similar code 25
I have an interesting problem. I wrote the following perl script to recursively loop
I have the following problem. I wrote a query to get the date of
I have the following tables: FACULTY table CREATE TABLE FACULTY ( FACULTY_ID NUMBER(3,0), FACULTY_NAME
I'm trying to write an SQL Trigger with the following approximate form: CREATE TRIGGER
I have to create a trigger (not procedure) to update subtotal, shipping_charge, tax and
Currently I have to write the following to update an element already contained in
when handling data, i always have to write the following: var dataSourceRequest:URLRequest = new
I have to write a biginteger into a text file using the following statement.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.