oracle - Can't run script - error: PLS-00428: an INTO clause is expected in this SELECT statement -


i have code won't run because expects clause in select statement:

declare   statuscode varchar2(255); begin statuscode := '';   select acc.accountno,     acc.accounttitle,     nvl(cus.title,'')     title,     nvl(cus.surname,'')   surname,     nvl(cus.forename1,'') forename1,     acc.gbp_balance,     case       when sc.excludefromscv = 1       'yes'       else 'no'     end excludedaccount   dim_fm_fscs_account acc   inner join dim_fm_fscs_customeracclink lnk   on acc.id = lnk.fscsaccountlink   left join dim_fm_fscs_customer cus   on lnk.fscscustomerlink = cus.id   left join dim_fm_fscs_statuscode sc   on (acc.exclusioncode        = ''   , sc.code                  = acc.accountstatuscode)   or (sc.code                  = acc.exclusioncode)   (acc.accountstatuscode = statuscode   , acc.exclusioncode        = '')   or acc.exclusioncode         = statuscode; end; 

however unsure how add , how it'll work script.

can have help?

the error message clear enough: in pl/sql can not make select query without fetching result variable.

for example:

sql> begin   2      select 1, 2 dual;   3  end;   4  /     select 1, 2 dual;     * error @ line 2: ora-06550: riga 2, colonna 5: pls-00428: clause expected in select statement   sql> declare   2      v1 number;   3      v2 number;   4  begin   5      select 1, 2   6      v1, v2   7      dual;   8  end;   9  /  pl/sql procedure completed.  sql> 

so need define variable handle result(s) of query.

notice in example used 2 scalar variables, if query can return more 1 row, need use collection fetch data; example:

declare     type tylistnum table of number;     vlist1 tylistnum;     vlist2 tylistnum; begin         select 1, 2     bulk collect vlist1, vlist2     dual     connect level <= 2;     --     -- whatever need fetched values end;         

Comments

Popular posts from this blog

c - zlib and gdi32 with OpenSSL? -

java - inputmismatch exception -

ios - Align baselines with characters in large line heights with Text Kit -