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 7614813
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T02:29:54+00:00 2026-05-31T02:29:54+00:00

I am working the following question for my Oracle class. I have the solution

  • 0

I am working the following question for my Oracle class. I have the solution below, that works, but I would like to format the dollar output. When I add the “TO_CHAR” statement, I get an error that “FROM” is not where expected.

Homework assignment question:

Use the Oracle database employees table and CASE expression to decode the department id. Display the department id, last name, salary and a column called “New Salary” whose value is based on the following conditions:
If the department id is 10 then 1.25 * salary
If the department id is 90 then 1.5 * salary
If the department id is 130 then 1.75 * salary
Otherwise, display the old salary.

Working statement WITHOUT the “TO_CHAR”:

SELECT LAST_NAME AS "LAST NAME", DEPARTMENT_ID AS "DEPARTMENT ID", SALARY,
CASE DEPARTMENT_ID
WHEN 10 THEN SALARY * 1.25
WHEN 90 THEN SALARY * 1.50
WHEN 130 THEN SALARY * 1.75
ELSE SALARY END AS "NEW SALARY"
FROM EMPLOYEES;

Statement that errors out:

SELECT LAST_NAME AS "LAST NAME, DEPARTMENT_ID AS "DEPARTMENT ID", SALARY,
CASE DEPARTMENT_ID
WHEN 10 THEN TO_CHAR (SALARY*1.25, '$99,999.99')
WHEN 90 THEN TO_CHAR (SALARY*1.50, '$99,999.99')
WHEN 130 THEN TO_CHAR (SALARY*1.75, '$99,999.99')
ELSE SALARY END AS "NEW SALARY"
FROM EMPLOYEES;

THANKS!

Result after correction below:

LAST NAME DEPARTMENT ID SALARY NEW SALARY
King 90 24000 $36,000.00
Kochhar 90 17000 $25,500.00
De Haan 90 17000 $25,500.00

  • 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-31T02:29:56+00:00Added an answer on May 31, 2026 at 2:29 am

    Craig’s explanation of the problem is correct, but instead of just adding yet another TO_CHAR, I would say wrap the whole CASE expression in a single TO_CHAR:

    SELECT LAST_NAME AS "LAST NAME", DEPARTMENT_ID AS "DEPARTMENT ID", SALARY,
    TO_CHAR(
     CASE DEPARTMENT_ID
     WHEN 10 THEN SALARY * 1.25
     WHEN 90 THEN SALARY * 1.50
     WHEN 130 THEN SALARY * 1.75
     ELSE SALARY END,
     '$99,999.99'
     ) AS "NEW SALARY"
    FROM EMPLOYEES;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following question: I am working on a JQuery script that turns
I am altering the question now! I have the search working using the following:
I am working on game engine prototype and have the following question: Right now
I'm have the following working example to retrieve a specific Wikipedia page that returns
folks. I would really appreciate to have your help on the following question: In
I'm working on my compiler homework and I have the following question: Consider the
I'm currently learning algorithms in my spare time but have the following question while
I'm working on a college exercise and have the following question: What is the
I have a following question. We use log4j in our two projects, that are
I'm working for a university project, and I have the following question: I have

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.