-1

can you please suggest using loops (IF else) ...like reading the data using conditions i.e. <=5, and by insert statement storing it in a temporary table variable and by using final select statement we are getting the output... plz help

enter code here

Input table is having data and result table should read all the data from the input table and check the length of the Name column and should print the length which is <=5 in the result table

Dipu Raj
  • 1,784
  • 4
  • 29
  • 37
  • You [already](https://stackoverflow.com/questions/53499815/sql-query-using-cursor-and-table-variable) asked this question, and got answers (and tips on how to ask a good question, please listen to that advise). – HoneyBadger Nov 28 '18 at 07:09
  • Possible duplicate of [SQL Query Using Cursor and table variable](https://stackoverflow.com/questions/53499815/sql-query-using-cursor-and-table-variable) – barbsan Nov 28 '18 at 07:49

1 Answers1

-1
DECLARE
     CURSOR c_input
     IS
          SELECT * FROM table_a;
BEGIN
     FOR x IN c_input
     LOOP
          IF LEN(x.name) <= 5 THEN
               dbms_output.put_line(x.name) ;
               --Insert statement if you wish to insert this in result table
          END IF;
     END LOOP;
END;

Thanks, Jayati