title: Ora 01403 when try to insert data into oracle table
body: <p>I have the following trigger</p>
  
  <pre><code>        CREATE OR REPLACE TRIGGER L_BIUR_G_LAY
           BEFORE INSERT OR UPDATE ON G_LAY
           FOR EACH ROW
          When (new.g_roo is not null)
            DECLARE
            x number(1);
           stmt varchar(255);
             BEGIN
            FOR I IN (SELECT DISTINCT G_TAB FROM G_LEG)
            LOOP
  
                 stmt := 'select distinct g_lind from ' || i.g_tab || ' where g_roo = ' || :new.g_roo;
            Execute immediate stmt into x;
  
          IF (x&lt;&gt;0)  THEN 
        RAISE_APPLICATION_ERROR(-2001, 'G_ROO  cannot be inserted where G_LIND IS NOT ZERO');
           END IF;
             END LOOP;
      END;
   /
  </code></pre>
  
  <p>and when I do </p>
  
  <pre><code>   insert into G_LAY (G_OGCS, G_OGC, G_ROO, G_NM, G_TI,   G_AB, G_DATE)
          (select G_LAY_SEQ.NEXTVAL, 1, G_ROO, G_LGNDIT, G_UNE, 'Pipe  Data Long - ' || G_UR, sysdate
               from G_DTABLE where G_LIND = 0);
  </code></pre>
  
  <p>I get the following error
  Error report:
  SQL Error: ORA-01403: no data found
  ORA-06512: at "L_BIUR_G_LAY", line 10
  ORA-04088: error during execution of trigger 'G_LAY'
  01403. 00000 -  "no data found"</p>
  
  <p>Any help would be greatly appreciated. It tried PRAGMA AUTONOMOUS_TRANSACTION after Declare in my trigger but it didn't help me</p>