As you see below this is a really simply select statement. It is not in a stored procedure, I recently added the variables START_DT and END_DT so that I could use it more dynamically. I get the following error:
ORA-06550: line 8, column 1: PLS-00428: an INTO clause is expected in this SELECT statement 06550. 00000 - "line %s, column %s:\n%s"
I looked all over and most of the issues I see have to do with stored procedures so I apologize if this is a duplicate. I am fairly new to PL/SQL but I have used SQL Server for over 7 years, so I imagine this is a grammatical thing. Below is my code
DECLARE
START_DT DATE;
END_DT DATE;
BEGIN
START_DT := TO_DATE('2015-06-01');
END_DT := TO_DATE('2015-06-30');
select TRUNC(txns.txn_gl_post_dt) DATED,
acc.acc_nbr ACCT,
ACC.ACC_POO_POOL POOL,
txns.txn_amt CHGOFF_AMT
FROM ACCOUNTS ACC
JOIN TXNS TXNS
ON TXNS.TXN_AAD_ID = ACC.ACC_AAD_ID
AND TXNS.TXN_TCD_CODE = 'ADV_CHGOFF'
WHERE ACC.ACC_STATUS_CD in ('CHGOFF','ACTIVE')
AND TRUNC(TXNS.TXN_GL_POST_DT) BETWEEN START_DT AND END_DT
order by 1;
END;
I suspect it is how I am handling the variables, any thoughts?