6 Replies Latest reply: Sep 19, 2013 11:09 AM by JagannathRao RSS

    ERROR - EXECUTE IMMEDIATE COUNT ?

    741795
      Hi everybody;

      I've got an error (Oracle 9i) with this code :
       
      
      FUNCTION check_identique (tabl IN varchar2)
      RETURN BOOLEAN
      IS
             test  NUMBER;
      BEGIN
           dbms_output.put_line('-- Check identique table -- '|| tabl);
           EXECUTE IMMEDIATE 'SELECT COUNT(*) FROM (SELECT * FROM :tabl MINUS SELECT * from :tabl@dbLink_PROD)' INTO test USING tabl;
           RETURN (test > 0);
      END check_identique;
      
      ...
      
      BEGIN 
      
      OPEN C_all_tables;
      LOOP /* Boucle sur les tables */
      FETCH C_all_tables INTO tabl;
           IF check_identique(tabl) THEN 
                /* Les tables ne sont pas identiq on affiche les lignes en cause */
                dbms_output.put_line (' Les tables possèdent des différences : ');
           ELSE
                /*Les tables sont identiques */
                dbms_output.put_line (' Les tables '|| tabl || 'sont similaires. ');
           END IF;
           
      EXIT WHEN C_all_tables%NOTFOUND;
      END LOOP;
      CLOSE C_all_tables;
      
      END;
      /
      The returned error :
      -- Check identique pour la table --ADRADAP_A
      DECLARE
      *
      ERROR at line 1:
      ORA-00907: missing right parenthesis
      ORA-06512: at line 15
      ORA-06512: at line 25
      Where is the issue ? Can I make a COUNT in a EXECUTE IMMEDIATE statement ?
      Thanks for your help, regards .