Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7191595
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T19:45:46+00:00 2026-05-28T19:45:46+00:00

Can anyone tell me why this won’t execute? set serveroutput on ; Declare TYPE

  • 0

Can anyone tell me why this won’t execute?

set serveroutput on ;
Declare
   TYPE type_emp IS RECORD(
        emp_name employees.last_name%TYPE,
        emp_salary employees.salary%TYPE);
     rec_emp type_emp;
   due_for_a_raise CHAR(1);
begin
   SELECT last_name, salary into rec_emp
   from employees
   where employee_id = 150;
   if emp_salary > 5000 then
      due_for_a_raise := 'Y';
     else
      due_for_a_raise := 'N';
   end if;
  dbms_output.putline(last_name);
  dbms_output.putline(salary);
  dbms_output.putline(due_for_a_raise);
end;  

Errors are below

Error report:
ORA-06550: line 11, column 6:
PLS-00201: identifier 'EMP_SALARY' must be declared
ORA-06550: line 11, column 3:
PL/SQL: Statement ignored
ORA-06550: line 16, column 23:
PLS-00201: identifier 'LAST_NAME' must be declared
ORA-06550: line 16, column 3:
PL/SQL: Statement ignored
ORA-06550: line 17, column 23:
PLS-00201: identifier 'SALARY' must be declared
ORA-06550: line 17, column 3:
PL/SQL: Statement ignored
ORA-06550: line 18, column 15:
PLS-00302: component 'PUTLINE' must be declared
ORA-06550: line 18, column 3:
PL/SQL: Statement ignored

I guess I don’t know why it isn’t being declared since they are being declared in the type_emp.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T19:45:47+00:00Added an answer on May 28, 2026 at 7:45 pm

    You’d need to use the record when you’re referencing them. Your calls to dbms_output.put_line also need to have an underscore between put and line.

    SQL> ed
    Wrote file afiedt.buf
    
      1  Declare
      2     TYPE type_emp IS RECORD(
      3          emp_name employees.last_name%TYPE,
      4          emp_salary employees.salary%TYPE);
      5       rec_emp type_emp;
      6     due_for_a_raise CHAR(1);
      7  begin
      8     SELECT last_name, salary
      9       into rec_emp
     10       from employees
     11      where employee_id = 150;
     12     if rec_emp.emp_salary > 5000 then
     13        due_for_a_raise := 'Y';
     14       else
     15        due_for_a_raise := 'N';
     16     end if;
     17    dbms_output.put_line(rec_emp.emp_name);
     18    dbms_output.put_line(rec_emp.emp_salary);
     19    dbms_output.put_line(due_for_a_raise);
     20* end;
    SQL> /
    
    PL/SQL procedure successfully completed.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can anyone tell me why this canvas won't show up? I just don't get
Can anyone please tell my why this method won't compile? void Statistics::readFromFile(string filename) {
can anyone tell me why this does not work Excel.Worksheet ws_res = (Excel.Worksheet) wb.Worksheets.Add(mis,
Can anyone tell me why this bash script works if I cut and paste
Can anyone tell me why this would generate a syntax error in Safari and
can anyone tell me why this code don't work: $q = $_GET['q']; // Load
Can anyone tell me what exactly does this Java code do? SecureRandom random =
Can anyone tell me how do this? They are already integers, so I'm not
Can anyone tell me what's wrong with this code? class Dataset < ActiveRecord::Base has_many
Can anyone tell me in simple words that what this L value is and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.