Sourabh Sharma
Sourabh Sharma

Reputation: 1

Why I am getting below warning and can not excute this procedure

SQL

I am running this in SQL DEVELOPER but it's compiling with warning and also while executing saying invalid command

create or replace procedure testproc as 
BEGIN
SELECT * FROM TEST
WHERE c1 = 'A';
END;

Upvotes: 0

Views: 65

Answers (1)

Indiecoder
Indiecoder

Reputation: 186

You need to declare a variable in Plsql every time you are selecting a value.. Here I have used %ROWTYPE to fetch the entire row in to variable test_var However it depends on your requirement what you want to do. check the snippet and you will get the idea..

   CREATE OR REPLACE PROCEDURE testproc
    AS
      test_var test%rowtype;
    BEGIN
      SELECT * INTO test_var FROM TEST WHERE c1 = 'A';
    END;
    /

Upvotes: 2

Related Questions