Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 528
  • Last Modified:

PLSQL error

Running the  code below in a TOAD editor window,  I receive the following error:
v_ORG VARCHAR2(40) := '';
v_TMF VARCHAR2(40) := '';
BEGIN
SELECT v_ORG/*,
        (CASE
           when US_USERNAME in ('SAJEB') then v_ORG := 'SUPERVISOR'
           else v_ORG := 'NOT SUPERVISOR'
         END
         ) */
      FROM imaging_history.ir_base_mv irb
      ;
END;
Error at line 1
ORA-06550: line 5, column 1:
PLS-00428: an INTO clause is expected in this SELECT statement

Script Terminated on line 1.
This does not make sense to me. I would appreciate your help.
Sincerely,
Christine
DECLARE 
v_ORG VARCHAR2(40) := '';
v_TMF VARCHAR2(40) := '';
BEGIN
SELECT v_ORG/*,
        (CASE 
           when US_USERNAME in ('SAJEB') then v_ORG := 'SUPERVISOR'
           else v_ORG := 'NOT SUPERVISOR'
         END 
         ) */
      FROM imaging_history.ir_base_mv irb
      ;
END;

Open in new window

0
cringleb
Asked:
cringleb
  • 2
1 Solution
 
sonicefuCommented:
into v_ORG is required
DECLARE 
v_ORG VARCHAR2(40) := '';
v_TMF VARCHAR2(40) := '';
BEGIN
SELECT v_ORG into v_ORG/*,
        (CASE 
           when US_USERNAME in ('SAJEB') then v_ORG := 'SUPERVISOR'
           else v_ORG := 'NOT SUPERVISOR'
         END 
         ) */
      FROM imaging_history.ir_base_mv irb
      ;
END;

Open in new window

0
 
sonicefuCommented:
what is the column name of the table/view imaging_history.ir_base_mv which you want to retrieve/fetch  ?

SELECT v_ORG  <---- here should be the column name which you want to retrieve, v_ORG is a variable name.
      FROM imaging_history.ir_base_mv irb
      ;


you statement should be

SELECT tableColumnName INTO variableName
FROM tableName;


in your statement you mentioned the variable name but not the table column name.
0

Featured Post

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now