2 Replies Latest reply on Sep 6, 2016 1:16 PM by 3305994

    PLS-00428

    3305994

      Hello!

       

       

      I declare a variable.

       

      DECLARE cSuch CONSTANT VARCHAR2(30) := 'Aurich';

      BEGIN 

        SELECT * FROM all_tab_columns WHERE data_type like '%VARCHAR2' and owner = 'WODIS';

      END;

       

      And although I did not use it, I get the following error message:

       

      Fehler beim Start in Zeile : 6 in Befehl -

      DECLARE cSuch CONSTANT VARCHAR2(30) := 'Aurich';

      BEGIN 

        SELECT * FROM all_tab_columns WHERE data_type like '%VARCHAR2' and owner = 'WODIS';

      END;

      Fehlerbericht -

      ORA-06550: Zeile 3, Spalte 3:

      PLS-00428: In dieser SELECT-Anweisung wird eine INTO-Klausel erwartet

      06550. 00000 -  "line %s, column %s:\n%s"

      *Cause:    Usually a PL/SQL compilation error.

       

      What could be wrong?

        • 1. Re: PLS-00428
          thatJeffSmith-Oracle

          In an anonymous PL/SQL block, you can't just run a SQL statement, you at a minimum need to SELECT INTO something.

           

          declare

          code varchar2(4000);

          begin

          select text into code from user_source fetch first 1 rows only;

          -- do SOMETHING with 'code'

          end;

          /

           

          run with F5..

           

          PL/SQL procedure successfully completed.

          • 2. Re: PLS-00428
            3305994

            Hi Jeff!

             

             

            I wanted to use only one variable in a SQL-Statement.

            I have now solved:

             

             

            define zSuch = 'Fred';

             

            SELECT 'SELECT * from ' || table_name || ' where ' || COLUMN_NAME || ' LIKE ''&zSuch%'';'

            FROM all_tab_columns

            WHERE data_type like '%VARCHAR2' and owner = 'WODIS';

             

            Thank you! for your help.

             

             

            Fred.