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

  • Home
  • SEARCH
  • 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 8636335
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T10:12:37+00:00 2026-06-12T10:12:37+00:00

I have a trigger statement like this: CREATE TRIGGER update_customer_address UPDATE OF address ON

  • 0

I have a trigger statement like this:

CREATE TRIGGER update_customer_address UPDATE OF address ON customers 
  BEGIN
    UPDATE orders SET address = new.address WHERE customer_name = old.name;
    -- RAISE ...
  END;
END;

EDIT:

I want to do a step:

int result = sqlite3_step(statement);

I know result returns the result code like SQLITE_DONE, SQLITE_ROW, and SQLITE_CONSTRAINT. I also discovered that RAISE ABORT within TRIGGER returns SQLITE_CONSTRAINT to result.

Is there a way for me to create a custom error code? I want to do something like

int result = sqlite3_step(statement);
// get custom error code here

Is it possible to raise with a custom error code in sqlite? Or are there any workarounds?

  • 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-12T10:12:38+00:00Added an answer on June 12, 2026 at 10:12 am

    You can throw an error using the RAISE() function.
    You have to use pre-defined error codes (IGNORE, ABORT, FAIL or ROLLBACK) but you can add a custom message:

    CREATE TRIGGER update_customer_address UPDATE OF address ON customers 
    BEGIN
      UPDATE orders SET address = new.address WHERE customer_name = old.name;
      SELECT CASE
        WHEN ( (SELECT * from orders WHERE address = 'old address!!') IS NOT NULL)
        THEN RAISE (FAIL, 'Can still find old address, not everything was updated!')
      END;
    END;
    

    Note that RAISE() is meant to be used only when something was wrong, see the doc for more information about raise() behavior.

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

Sidebar

Related Questions

I have a trigger that looks something like this: create or replace TRIGGER cluster_check
I have a table trigger like below: CREATE OR REPLACE TRIGGER PAT_BUR_DOB_TRG BEFORE UPDATE
I have an update statement in a stored procedure that looks generally like this:
I have below trigger ALTER TRIGGER [dbo].[DeleteUserData] ON [dbo].[site_users] AFTER DELETE AS BEGIN SET
I have a table that looks like this: CREATE TABLE [dbo].[SomeTable]( [Guid] [uniqueidentifier] NOT
I have an INSERT statement that looks like this: INSERT INTO officer (officer_number, name,
I have a table that simplified looks like this: create table Test ( ValidFrom
I have a trigger for insert/update/delete. That is working fine. Also, I need the
I have this trigger which works functionally (as far as I can tell by
is is possible in postgres to have a trigger on CREATE TABLE that will

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.