Hi group,
I’m in the process of creating a script. I believe I need to DECLARE some variables as NUMBERs as that is what I need their output to be. Eventually I’m going to do some math with these numbers. However when attempting to run my script I’m getting an error message that says
ORA-06550: line 8, column 1:
PLS-00428: an INTO clause is expected in this SELECT statement
I’ve done a fair amount of research to find the correct syntax to use the SELECT INTO clause. However I’ve not found it yet. Here’s the original script as I’ve written it:
DECLARE Period_Out_Month_Number NUMBER;
Period_Out_Year_Number NUMBER;
Open_Date_Month_Number NUMBER;
Open_Date_Year_Number NUMBER;
BEGIN
Select Distinct b.prop_master_id,
a.periods_out_desc,
b.Open_Date,
Case
When (SUBSTR(a.periods_out_desc,0,3)) in ‘Jan’ then 1
when (SUBSTR(a.periods_out_desc,0,3)) in ‘Feb’ then 2
when (SUBSTR(a.periods_out_desc,0,3)) in ‘Mar’ then 3
when (SUBSTR(a.periods_out_desc,0,3)) in ‘Apr’ then 4
when (SUBSTR(a.periods_out_desc,0,3)) in ‘May’ then 5
when (SUBSTR(a.periods_out_desc,0,3)) in ‘Jun’ then 6
when (SUBSTR(a.periods_out_desc,0,3)) in ‘Jul’ then 7
when (SUBSTR(a.periods_out_desc,0,3)) in ‘Aug’ then 8
when (SUBSTR(a.periods_out_desc,0,3)) in ‘Sep’ then 9
when (SUBSTR(a.periods_out_desc,0,3)) in ‘Oct’ then 10
when (SUBSTR(a.periods_out_desc,0,3)) in ‘Nov’ then 11
when (SUBSTR(a.periods_out_desc,0,3)) in ‘Dec’ then 12
end as Period_Out_Month_Number,
(SUBSTR(a.periods_out_desc,-4,4)) Period_Out_Year_Number,
EXTRACT(MONTH FROM b.Open_Date) Open_Date_Month_Number,
EXTRACT(YEAR FROM b.Open_Date) Open_Date_Year_Number
from dmart.F_ST_PERIOD_WKLY a,
crmmart.d_prop b
where b.prop_master_id in (‘123’) and
(SUBSTR(a.periods_out_desc,-4,4) in (‘2008’, ‘2009’, ‘2010’, ‘2011’, ‘2012’, ‘2013’, ‘2014’, ‘2015’)) and
(SUBSTR(a.periods_out_desc,0,3) in (‘Jan’, ‘Feb’, ‘Mar’, ‘Apr’, ‘May’, ‘Jun’, ‘Jul’, ‘Aug’, ‘Sep’, ‘Oct’, ‘Nov’, ‘Dec’))
ORDER BY b. prop_master_id,
a.periods_out_desc;
End;
My questions are:
-
how do I property use the SELECT INTO clause?
-
what is the correct syntax and where to I insert the “INTO”?
In advance, thanks for any and all help.
Don