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 6972877
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:01:52+00:00 2026-05-27T17:01:52+00:00

I need to do a trigger but the only difference that I’m trying to

  • 0

I need to do a trigger but the only difference that I’m trying to do is to get a dynamic value according to ‘:new.COLUMN_NAME’ and ‘:old.COLUMN_NAME’

I’m bringing the columns of a table in a query and after that I run it with a for LOOP ..

this is my trigger:

CREATE OR REPLACE TRIGGER aft_ins_soliccambio
AFTER INSERT OR DELETE OR UPDATE
ON SEG_V_SOLICCAMBIO
REFERENCING OLD AS OLD NEW AS NEW
FOR EACH ROW
DECLARE
   old_col_value   VARCHAR2 (4000);
   new_col_value   VARCHAR2 (4000);
BEGIN
   FOR REC IN (  SELECT OWNER, TABLE_NAME, COLUMN_NAME
                   FROM all_tab_columns
                  WHERE OWNER = 'EUCEDA' AND (TABLE_NAME = 'SEG_V_SOLICCAMBIO')
               ORDER BY column_id)
   LOOP
      EXECUTE IMMEDIATE ' select :new.' || REC.COLUMN_NAME || ' from dual'
               INTO new_col_value;

      pkg_tumi.insert_auditoria ('SEG_V_SOLICCAMBIO',
                                 REC.COLUMN_NAME,
                                 :new.EMPR_IDEMPRESA_N,
                                 fn_get_pk ('SEG_V_SOLICCAMBIO', 1),
                                 fn_get_pk ('SEG_V_SOLICCAMBIO', 2),
                                 fn_get_pk ('SEG_V_SOLICCAMBIO', 3),
                                 fn_get_pk ('SEG_V_SOLICCAMBIO', 4),
                                 fn_get_pk ('SEG_V_SOLICCAMBIO', 5),
                                 fn_get_pk ('SEG_V_SOLICCAMBIO', 6),
                                 1,
                                 '',
                                 new_col_value,
                                 SYSDATE,
                                 NULL);
   END LOOP;
END;

when I compile the trigger it doesn’t throw any error but when I try inserting a new value in the table that I’m making the trigger it throws this error:

ORA-01008: no todas las variables han sido enlazadas
ORA-06512: en “EUCEDA.AFT_INS_SOLICCAMBIO”, línea 10
ORA-04088: error durante la ejecución del disparador ‘EUCEDA.AFT_INS_SOLICCAMBIO’

Checking the problem I realized that the problem is between ‘EXECUTE IMMEDIATE ..’ but I see that is because of :new.’dynamic_column’ is not recognized. Please Help! I’m many hours with this problem and I can’t solve it.

Thanks and sorry for my english.

  • 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-05-27T17:01:53+00:00Added an answer on May 27, 2026 at 5:01 pm

    :new and :old within triggers are somewhat inflexible. I don’t know of any way of using dynamic SQL to do what you’re attempting to do with your EXECUTE IMMEDIATE. I suspect it’s not possible.

    I’m afraid the only alternatives I know about are somewhat laborious. One such alternative is to replace the EXECUTE IMMEDIATE with a CASE expression such as the following:

        new_col_value := CASE REC.COLUMN_NAME
                           WHEN 'COLUMN_1' THEN :new.column_1
                           WHEN 'COLUMN_2' THEN :new.column_2
                           WHEN 'COLUMN_3' THEN :new.column_3
                           ...
                         END;
    

    It might be possible to run a suitable SQL statement to generate all of the WHEN ... THEN ... lines within this CASE statement rather than typing them all in yourself.

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

Sidebar

Related Questions

I need to create Trigger for delete action which backsup all fields old value
I need to write a trigger that rounds a value whenever it is inserted/updated
I often want to trigger a certain function just once, but I need to
I have a trigger that gets inserts and updates to a view. I need
I'm defining a delete trigger, and I need to backup the row deleted but
I have python script that works fine but only when run as stand-alone, while
I need to trigger a block of code after 20 minutes from the AlarmManager
I need to trigger a page to start acting, without interfering with client's processes.
Quick (and hopefully easy) question: I need to trigger a download of a PDF
What I need is: what trigger to use and where to put it. I

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.