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

  • Home
  • SEARCH
  • 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 4025992
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T10:54:55+00:00 2026-05-20T10:54:55+00:00

I posted a similar question yesterday with the same code, I have rewritten and

  • 0

I posted a similar question yesterday with the same code, I have rewritten and it should be perfect to a new specification but for some reason it is not working.

I am using Oracle 10g Express.

The code below is working out the top 10% of earning solicitors.

CREATE VIEW rich_solicitors AS
select notes.time_spent*rate.rate_amnt+coalesce(special_rate.s_rate_amnt,0)
AS solicitor_made, notes.solicitor_id
FROM notes, rate, solicitor_rate, solicitor, case, contract, special_rate
WHERE notes.solicitor_id = solicitor.solicitor_id
AND solicitor.solicitor_id = solicitor_rate.solicitor_id
AND solicitor_rate.rate_id = rate.rate_id
AND notes.case_id = case.case_id
AND case.contract_id = contract.contract_id
AND contract.contract_id = special_rate.contract_id (+)
ORDER BY -solicitor_made;


SELECT * FROM rich_solicitors
WHERE ROWNUM <= (SELECT COUNT(*)/10 FROM rich_solicitors);

I need to work out the top 10% of last year, I thought it would be as easy as adding the start_date and expiry_date to the SELECT and adding the following WHERE function:

AND contract.start_date >= 01-01-10
AND contract.expiry_date <= 01-01-11

I have inserting the date corectly using TO_DATE. My lecturer spent a good hour with me working out why this wouldnt work but to no avail.

It kept on returning the error – ORA-00932: inconsistent datatypes: expected CHAR got NUMBER

I also tried defining the date format and that still returned the same error

CREATE VIEW rich_solicitors1 AS
SELECT  notes.time_spent*rate.rate_amnt+coalesce(special_rate.s_rate_amnt,0) AS solicitor_made, notes.solicitor_id, TO_CHAR(contract.start_date, 'DD-MM-YY'), TO_CHAR(contract.expiry_date, 'DD-MM-YY')
FROM notes, rate, solicitor_rate, solicitor, case, contract, special_rate
WHERE notes.solicitor_id = solicitor.solicitor_id
AND solicitor.solicitor_id = solicitor_rate.solicitor_id
AND solicitor_rate.rate_id = rate.rate_id
AND notes.case_id = case.case_id
AND case.contract_id = contract.contract_id
AND contract.contract_id = special_rate.contract_id (+)
AND contract.start_date >= 01-01-10
AND contract.expiry_date <= 01-01-11
ORDER BY -solicitor_made;

any ideas?

Many thanks, any criticism is much appreciated, I am a student and at my very first steps with this, before about 9 days ago I had no SQL knowledge at all.

  • 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-20T10:54:55+00:00Added an answer on May 20, 2026 at 10:54 am

    Can you try i have replaced your coalesce by NVL function

    SELECT  notes.time_spent*rate.rate_amnt+NVL(special_rate.s_rate_amnt,0) 
    AS solicitor_made, notes.solicitor_id, TO_CHAR(contract.start_date, 'DD-MM-YY'), 
    TO_CHAR(contract.expiry_date, 'DD-MM-YY') 
    FROM notes, rate, solicitor_rate, solicitor, case, contract, special_rate 
    WHERE notes.solicitor_id = solicitor.solicitor_id 
    AND solicitor.solicitor_id = solicitor_rate.solicitor_id 
    AND solicitor_rate.rate_id = rate.rate_id AND notes.case_id = case.case_id 
    AND case.contract_id = contract.contract_id 
    AND contract.contract_id = special_rate.contract_id (+) 
    AND contract.start_date >= to_date('01-01-10','MM-DD-YY')
    AND contract.expiry_date <= to_date('01-01-11' ,'MM-DD-YY')
    ORDER BY solicitor_made
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I posted a similar RBL question but I have a new issue arising so
I have already posted something similar here but I would like to ask the
Following on from a question I posted yesterday about GUIs, I have another problem
I know that I was already posted similar question but I just can't find
I kind of posted a similar question a couple of days ago but that
(I've posted a similar question before but now it is more targeted..) I am
A similar question is posted here . I have an undirected graph with Vertex
A similar question was posted as question:is-there-a-way-to-use-multiple-wsit-client-xml.. . I have two different WS-Security enabled
A similar question has been posted at but i could not find the solution
I posted a similar question on how scalable linq is. There were so many

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.