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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T13:42:24+00:00 2026-05-30T13:42:24+00:00

I’m trying to implement a trigger to search values on a table, and, if

  • 0

I’m trying to implement a trigger to search values on a table, and, if it checks the condtion then insert in another table. The Trigger looks like this:

TRIGGER DISTANCIA
AFTER INSERT ON OBSERVACION FOR EACH ROW
DECLARE
importe_multa NUMBER (3,0);
BEGIN
 FOR ROW IN (SELECT fecha_foto, hora_foto, pto_km_radar, sentido_radar, carretera_foto FROM OBSERVACION) LOOP
    IF((ROW.fecha_foto = :NEW.fecha_foto)
    AND
    (ROW.carretera_foto= :NEW.carretera_foto)
    AND
    (ROW.pto_km_radar=:NEW.pto_km_radar)
    AND
    (ROW.sentido_radar=:NEW.sentido_radar))
    THEN

    IF(ROW.hora_foto<:NEW.hora_foto-3,6/86400)
    THEN
    importe_multa:= (:NEW.hora_foto - ROW.hora_foto - 3,6/86400)*100;
    END IF;
    IF(:NEW.hora_foto < ROW.hora_foto-3,6/86400)
    THEN
    importe_multa:= (ROW.hora_foto - :NEW.hora_foto - 3,6/86400)*100;
    END IF;

   IF(importe_multa IS NOT NULL)
   THEN
     --Introducimos el valor en el campo.
     INSERT INTO SANCION(importe, fecha_foto, hora_foto, coche, tipo)
     VALUES
     (importe_multa, :NEW.fecha_foto, :NEW.hora_foto, :NEW.coche, '2');
     END IF;
    END IF;
END LOOP;
END;

When I try to compile the SQLDeveloper software throws this error:

ORA-01008: Not all variables bound.

Am I referencing the variables in OBSERVACION right?

  • 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-30T13:42:25+00:00Added an answer on May 30, 2026 at 1:42 pm

    1) A row-level trigger on OBSERVACION cannot query then OBSERVACION table. If you do, you’ll get a mutating trigger error. So the approach is fundamentally problematic.

    2) I would expect that you’re getting the compilation error because you need to represent decimal numbers using the decimal point as the separator, not the comma. The comma is used to separate parameters to a function.

    3) If you really want to implement this sort of logic in a trigger rather than putting it in a procedure where it really belongs, you’ll need to work around the mutating trigger error with a series of triggers. This is going to make your code substantially more complex, harder to follow, and harder to debug. But it would allow you to do this using only triggers.

    CREATE OR REPLACE PACKAGE pkg_new_rows
    AS
      TYPE typ_new_row_array 
        IS TABLE OF rowid;
      g_new_rows typ_new_row_array;
    END;
    
    CREATE OR REPLACE TRIGGER trg_before_statement
      BEFORE INSERT ON OBSERVACION
    DECLARE
    BEGIN
      pkg_new_rows.g_new_rows := new pkg_new_rows.typ_new_row_array();
    END;
    
    CREATE OR REPLACE TRIGGER trg_before_row
      BEFORE INSERT ON observacion
      FOR EACH ROW
    DECLARE
    BEGIN
      pkg_new_rows.g_new_rows.extend;
      pkg_new_rows.g_new_rows( pkg_new_rows.g_new_rows.count ) := :new.rowid;
    END;
    
    CREATE OR REPLACE TRIGGER trg_after_statement
      AFTER INSERT ON observacion
    DECLARE 
      l_row observacion%rowtype;
    BEGIN
      FOR i IN 1 .. pkg_new_rows.g_new_rows.count
      LOOP
        SELECT *
          INTO l_row
          FROM observacion
         WHERE rowid := pkg_new_rows.g_new_rows(i);
    
       <<implement your logic by querying the other rows of the OBSERVACION table
         and comparing that to the data in the l_row record>>
      END LOOP;
    END;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
For some reason, after submitting a string like this Jack’s Spindle from a text
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I am trying to render a haml file in a javascript response like so:
I would like to run a str_replace or preg_replace which looks for certain words
I have some data like this: 1 2 3 4 5 9 2 6
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I would like to count the length of a string with PHP. The string

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.