We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you a podcast all about Citrix Workspace, moving to the cloud, and analytics & intelligence. Episode 2 coming soon!Listen Now

x

PLSQL error

cringleb
cringleb asked
on
Medium Priority
549 Views
Last Modified: 2013-12-07
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

Comment
Watch Question

Commented:
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

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Commented:
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.
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.