What is wrong?

declare type nt_type is table of string(10); nt nt_type := nt_type ('08.05.2013','09.05.2013');beginfor i in 1..nt.count loopselect request_id, request_emode, request_pgm, pp.description, name_id_no, substr(addressee,1,15), policy_no, pr.print_job,request_date from print_request pr, print_program ppwhere request_pgm = program_id and request_pgm not like ('B8350') and request_pgm not like ('BAT%') and request_pgm not like ('F%') and request_pgm not like ('KX%') and request_pgm not like ('269') and (pr.printer_id in (1,2) or pr.document_pile is not null) and request_emode not like ('X%') and trunc(request_date) = to_date(nt(i), 'DD.MM.YYYY')order by pr.print_job desc, name_id_no;end loop;end;

I agree, an implicit cursor (like yours) in PL\SQL requires an "into" line with either a record variable or discrete variables for each column being selected.

I see another potential problem in your query, that is: "trunc(request_date)". In a tiny test system, this will not be a problem. Also, in a new production system with few (or no) records initially, this will not be a problem either. But, as the number of records in this table increases, and especially if this column is indexed, your "trunc" will prevent the use of the index and force Oracle to read every record that meets the other criteria. That could add a huge performance penalty as the data in this table increases.

Try to avoid using any operators like: trunc, upper, lower, to_char, to_date, etc. on database columns referenced in your "where" clause. Do the conversion on the other side of the '=' sign instead. For date columns that may include a time-of-day, sometimes that means you will have to use "between" instead of "=", something like this:

and request_date between to_date(nt(i), 'DD.MM.YYYY') and to_date(nt(i), 'DD.MM.YYYY') + 86399/86400

Explanation:
1. There are 86,400 seconds in a day (60 x 60 x 24).
2. Your first "to_date" with no time component included, will mean a time of midnight (the first second in the day).
3. The second "to_date" adds enough seconds to get to the last second of the day, so a "request_date" value that includes any time of that day will be included..

First you ask what I expect, I'd expect the output of two SELECTs in the output window of Oracle SQL Developer just as I get the output from one select when I enter it and run it.

I will try your suggested solutions tomorrow. Partly this is also since I'm trying to learn.
I have used a lot of relatively straight forward SELECTs for many years, but have used another programming language to manipulate and get the results that I wanted. I thought it would be interresting to go one step further and do it all using sql.

I hear what you say about the INTO, but I have never used it like this. My selects usually are in the form:

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Featured Post

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Introduction
A previously published article on Experts Exchange ("Joins in Oracle", http://www.experts-exchange.com/Database/Oracle/A_8249-Joins-in-Oracle.html) makes a statement about "Oracle proprietary" joins and mixes the join syntax with gen…

How to Unravel a Tricky Query
Introduction
If you browse through the Oracle zones or any of the other database-related zones you'll come across some complicated solutions and sometimes you'll just have to wonder how anyone came up with them. …