In preparation to creating a stored procedure to automate some queries I'm running, I created an anonymous block to test something. This is what I have:
InvoiceDate VARCHAR2 (9) := '05APR2015';
From invoices a
Join customers b
On a.cust_id = b.cust_id
Where a.invoice_dt >= InvoiceDate
Order By b.customer, a.invoice_dt, a.invoice_number;
When I run this, it tells me an INTO clause is expected in this SELECT statement.
Ok, I get that I need to put the result into a variable, but I don't know exactly how to do that. Should I declare a table variable, or a cursor? And if my goal is to see results from this (just as if I'd run the query with a hard-coded date instead of a variable) do I need to add dbms output?