Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Variable puzzle, cannot use a variable in a where clause
Hi,
I try to do something like select x from y where z = variable.
I cannot get it to work and could not find any example or info.
As an example the code bellow works as far as setting the variable
value is concerned however it returns an error.
ORA-06550: line 11, column 1:
PLS-00428: an INTO clause is expected in this SELECT statement.
When I try to use the variable in a select clause.
Thanks,
Phil
Declare my_Date number(6);
begin
select
TO_NUMBER(TO_CHAR(ADD_MONTHS(TO_DATE(TO_CHAR(a.fiscal_yyyymm_num),
'YYYYMM'), 3),'YYYYMM'))
Into my_Date
FROM dataware.fiscal_calendar a
WHERE a.query_dt = TRUNC(sysdate);
--dbms_output.put_line (my_Date);
Select * from dataware.Orders o where o.ShipSchedule_yyyymm_num = my_Date;
end; Received on Wed Jan 05 2005 - 15:01:31 CST
![]() |
![]() |