A
A
Alexey2015-10-20 13:09:47
Oracle
Alexey, 2015-10-20 13:09:47

Please look at the code and point out the error in the code?

in general, I have one query where I get a certain number of dates, then in another query, using a cursor and a loop, I want to display certain values ​​​​based on these dates, but in order to understand the queries themselves, I wanted to build a small example

create global temporary 
table dep_salary2
on commit preserve rows
as select distinct department_id, hire_date from hr.employees where salary > 9000 and hire_date = '04.03.04';

declare
  cursor c is select * from test_m;
begin 
  open c;
  loop
    fetch c into line;
      select department_id from hr.employees where hire_date = DAT;    
    exit when c%notfound;
  end loop;
  close c;
end;

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
faustxp, 2015-10-21
@faustxp

1. implicit type conversion
2. line and DAT variables are not defined
3. after the fetch you have a line of SQL code that will not work in the pl/sql block.
It is not at all clear from the code what it should do.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question